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
- FontStretch.cs
- MetadataException.cs
- SelectionPattern.cs
- OdbcDataAdapter.cs
- SqlBulkCopyColumnMapping.cs
- XmlNavigatorStack.cs
- Base64Encoder.cs
- SystemIcons.cs
- DrawListViewSubItemEventArgs.cs
- RunWorkerCompletedEventArgs.cs
- Expr.cs
- FlatButtonAppearance.cs
- CodeTryCatchFinallyStatement.cs
- MatrixCamera.cs
- UIntPtr.cs
- RuntimeHandles.cs
- DirectoryInfo.cs
- IsolatedStorageFileStream.cs
- BuildDependencySet.cs
- BitmapEffectInputData.cs
- ProxySimple.cs
- RijndaelManagedTransform.cs
- KeyValuePairs.cs
- TemplateBindingExtensionConverter.cs
- FormatVersion.cs
- IPHostEntry.cs
- EncoderParameter.cs
- FormsAuthentication.cs
- PagePropertiesChangingEventArgs.cs
- SmiMetaDataProperty.cs
- TrackingParameters.cs
- DecimalStorage.cs
- XmlValidatingReaderImpl.cs
- DataSourceSelectArguments.cs
- RelationshipConstraintValidator.cs
- CodeTypeOfExpression.cs
- AssemblyBuilder.cs
- BamlVersionHeader.cs
- PropertyItemInternal.cs
- WebServiceHandlerFactory.cs
- ExtenderProvidedPropertyAttribute.cs
- BoundField.cs
- ProjectionPathSegment.cs
- BulletedList.cs
- WindowAutomationPeer.cs
- TraceListener.cs
- COM2ColorConverter.cs
- DtrList.cs
- DateTimeFormatInfoScanner.cs
- XmlText.cs
- SecurityKeyType.cs
- StringValidator.cs
- EntityDataSourceContextDisposingEventArgs.cs
- LinearKeyFrames.cs
- columnmapkeybuilder.cs
- DataDocumentXPathNavigator.cs
- HeaderUtility.cs
- BrowsableAttribute.cs
- TimeZoneInfo.cs
- PriorityItem.cs
- Brush.cs
- DataTableCollection.cs
- FrugalList.cs
- CompilerCollection.cs
- ServiceMetadataBehavior.cs
- DynamicValueConverter.cs
- TextElementAutomationPeer.cs
- ObjectPersistData.cs
- Gdiplus.cs
- ProxyWebPartManager.cs
- ClosableStream.cs
- XPathParser.cs
- NullRuntimeConfig.cs
- PageTheme.cs
- CompositeDispatchFormatter.cs
- SecurityPermission.cs
- TextDecorationCollection.cs
- TraceHelpers.cs
- DataContractAttribute.cs
- SignatureToken.cs
- TreeNodeBinding.cs
- Pen.cs
- AdRotatorDesigner.cs
- UpdateCommandGenerator.cs
- CollectionDataContract.cs
- SqlDataSourceSelectingEventArgs.cs
- InternalSafeNativeMethods.cs
- RtfToXamlLexer.cs
- EncryptedPackage.cs
- CellCreator.cs
- _IPv6Address.cs
- FactoryMaker.cs
- TaskFactory.cs
- GlyphTypeface.cs
- DragDropManager.cs
- WinCategoryAttribute.cs
- GAC.cs
- DeviceContext2.cs
- AstTree.cs
- MessageBox.cs