Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Model / AttachedPropertiesService.cs / 1305376 / AttachedPropertiesService.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.Model { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime; public class AttachedPropertiesService { Listproperties; public AttachedPropertiesService() { this.properties = new List (); } public void AddProperty(AttachedProperty property) { if (property == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("property")); } if (string.IsNullOrEmpty(property.Name)) { throw FxTrace.Exception.AsError(new ArgumentException(SR.AttachedPropertyNameShouldNotBeEmpty)); } this.properties.Add(property); } internal IEnumerable GetAttachedProperties(Type modelItemType) { var properties = from property in this.properties where property.OwnerType.IsAssignableFrom(modelItemType) select property; if (modelItemType.IsGenericType) { var propertiesFromGenericRoot = from property in this.properties where property.OwnerType.IsAssignableFrom(modelItemType.GetGenericTypeDefinition()) select property; properties = properties.Concat(propertiesFromGenericRoot).Distinct(); } return properties; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.Model { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime; public class AttachedPropertiesService { List properties; public AttachedPropertiesService() { this.properties = new List (); } public void AddProperty(AttachedProperty property) { if (property == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("property")); } if (string.IsNullOrEmpty(property.Name)) { throw FxTrace.Exception.AsError(new ArgumentException(SR.AttachedPropertyNameShouldNotBeEmpty)); } this.properties.Add(property); } internal IEnumerable GetAttachedProperties(Type modelItemType) { var properties = from property in this.properties where property.OwnerType.IsAssignableFrom(modelItemType) select property; if (modelItemType.IsGenericType) { var propertiesFromGenericRoot = from property in this.properties where property.OwnerType.IsAssignableFrom(modelItemType.GetGenericTypeDefinition()) select property; properties = properties.Concat(propertiesFromGenericRoot).Distinct(); } return properties; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NotifyParentPropertyAttribute.cs
- WindowsListViewGroup.cs
- ServicePrincipalNameElement.cs
- XmlText.cs
- InputLangChangeEvent.cs
- ImportedNamespaceContextItem.cs
- MultiBinding.cs
- TabRenderer.cs
- GridLength.cs
- BaseProcessor.cs
- Baml2006ReaderSettings.cs
- PropertyBuilder.cs
- GenericXmlSecurityTokenAuthenticator.cs
- HostedNamedPipeTransportManager.cs
- Misc.cs
- XmlSchemaDatatype.cs
- ConnectionsZone.cs
- DBCSCodePageEncoding.cs
- Memoizer.cs
- InOutArgument.cs
- hwndwrapper.cs
- Camera.cs
- TemplatedEditableDesignerRegion.cs
- XmlEncoding.cs
- CallbackHandler.cs
- TypeDelegator.cs
- TemplateControl.cs
- WaitHandleCannotBeOpenedException.cs
- AspNetSynchronizationContext.cs
- BitmapEffectInput.cs
- StatusBarPanelClickEvent.cs
- PinnedBufferMemoryStream.cs
- Compress.cs
- InvalidPrinterException.cs
- WebZone.cs
- HandleExceptionArgs.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- ConditionalBranch.cs
- DbConnectionPoolOptions.cs
- Single.cs
- WorkflowRuntimeSection.cs
- XmlDataImplementation.cs
- TextSpanModifier.cs
- WebPartConnectionCollection.cs
- Keywords.cs
- HitTestResult.cs
- SingleObjectCollection.cs
- SqlDataSourceFilteringEventArgs.cs
- MetadataArtifactLoaderFile.cs
- DataGridSortCommandEventArgs.cs
- ProgressBarAutomationPeer.cs
- HttpClientCertificate.cs
- HijriCalendar.cs
- BookmarkTable.cs
- ControlCollection.cs
- PathNode.cs
- TextSelection.cs
- ControlAdapter.cs
- TableParaClient.cs
- DataGridCommandEventArgs.cs
- DesignerSerializerAttribute.cs
- LayoutUtils.cs
- CompilerGeneratedAttribute.cs
- Decimal.cs
- OracleBinary.cs
- XmlWellformedWriter.cs
- ApplicationSettingsBase.cs
- SemanticResolver.cs
- UpdatePanelControlTrigger.cs
- ToolStripItemEventArgs.cs
- CompilerError.cs
- QuotedStringFormatReader.cs
- ReadOnlyCollection.cs
- SoapFault.cs
- ToolStrip.cs
- EndPoint.cs
- GcSettings.cs
- WebPartAuthorizationEventArgs.cs
- ClientScriptItem.cs
- SqlBinder.cs
- ServiceNotStartedException.cs
- Repeater.cs
- LineVisual.cs
- RoutedUICommand.cs
- HttpRuntime.cs
- HttpResponseHeader.cs
- UserPreferenceChangingEventArgs.cs
- DbBuffer.cs
- SurrogateSelector.cs
- TdsParserSafeHandles.cs
- Confirm.cs
- SQLMembershipProvider.cs
- Baml2006ReaderSettings.cs
- ApplicationId.cs
- StringPropertyBuilder.cs
- DataSourceHelper.cs
- MemberPathMap.cs
- PageBuildProvider.cs
- ClassData.cs
- ExpressionConverter.cs