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
- XamlPoint3DCollectionSerializer.cs
- CommandSet.cs
- ScrollData.cs
- DesignerMetadata.cs
- ResourceIDHelper.cs
- TransactionProtocolConverter.cs
- LinqDataSourceView.cs
- RunClient.cs
- BuilderInfo.cs
- Roles.cs
- PartialClassGenerationTaskInternal.cs
- arclist.cs
- AttachedAnnotation.cs
- ButtonChrome.cs
- __FastResourceComparer.cs
- InvalidCastException.cs
- TransformCryptoHandle.cs
- WebPartsPersonalization.cs
- ListViewSortEventArgs.cs
- Permission.cs
- filewebrequest.cs
- ProfileParameter.cs
- LogicalExpr.cs
- TransformerConfigurationWizardBase.cs
- ButtonFlatAdapter.cs
- TreeView.cs
- ExternalException.cs
- DesignerAdapterUtil.cs
- RequiredAttributeAttribute.cs
- StorageSetMapping.cs
- FreeFormDesigner.cs
- MeasurementDCInfo.cs
- ConstructorArgumentAttribute.cs
- EntityContainerAssociationSet.cs
- ScriptResourceHandler.cs
- Aes.cs
- TextModifier.cs
- KnownBoxes.cs
- DateTimeConstantAttribute.cs
- ItemCheckEvent.cs
- _OverlappedAsyncResult.cs
- EncoderBestFitFallback.cs
- GlyphRunDrawing.cs
- GregorianCalendarHelper.cs
- WebPartCollection.cs
- HostSecurityManager.cs
- GenericPrincipal.cs
- DataGridSortCommandEventArgs.cs
- BeginEvent.cs
- Classification.cs
- CultureTable.cs
- DataGridViewBindingCompleteEventArgs.cs
- LongCountAggregationOperator.cs
- RegistrySecurity.cs
- Menu.cs
- PageContent.cs
- HwndAppCommandInputProvider.cs
- FileClassifier.cs
- Window.cs
- FilterElement.cs
- StringAnimationBase.cs
- GlyphRunDrawing.cs
- MessageDecoder.cs
- XmlObjectSerializerContext.cs
- MediaEntryAttribute.cs
- _KerberosClient.cs
- CompileXomlTask.cs
- ObjectCloneHelper.cs
- CanonicalizationDriver.cs
- SafeNativeMethods.cs
- DefaultTraceListener.cs
- WriteTimeStream.cs
- DatatypeImplementation.cs
- SqlConnectionStringBuilder.cs
- While.cs
- BinaryOperationBinder.cs
- DocumentGridPage.cs
- EventLogInformation.cs
- StateChangeEvent.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- PrinterUnitConvert.cs
- DateTimeSerializationSection.cs
- DataGridViewBand.cs
- LazyTextWriterCreator.cs
- FileEnumerator.cs
- OrderedHashRepartitionStream.cs
- DBNull.cs
- EntityTypeEmitter.cs
- Animatable.cs
- SqlNotificationEventArgs.cs
- NullableConverter.cs
- XmlSchemaAnyAttribute.cs
- XhtmlConformanceSection.cs
- RemoteWebConfigurationHostStream.cs
- FieldNameLookup.cs
- WebBrowserSiteBase.cs
- WinOEToolBoxItem.cs
- ProfileProvider.cs
- QilName.cs
- ServiceHttpModule.cs