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
- HwndStylusInputProvider.cs
- TableHeaderCell.cs
- DeviceContexts.cs
- ContentDesigner.cs
- GorillaCodec.cs
- SafeMILHandle.cs
- WaitHandle.cs
- MethodToken.cs
- DataSourceListEditor.cs
- ScriptReference.cs
- XmlDigitalSignatureProcessor.cs
- NonClientArea.cs
- XamlBuildTaskServices.cs
- ActiveDocumentEvent.cs
- AssemblyInfo.cs
- PkcsUtils.cs
- ResolveResponse.cs
- StartUpEventArgs.cs
- PathSegment.cs
- DataObjectEventArgs.cs
- MobileUserControl.cs
- DataSourceGeneratorException.cs
- DesignTimeSiteMapProvider.cs
- PeerNeighborManager.cs
- ServerIdentity.cs
- ScriptComponentDescriptor.cs
- LinqDataSourceContextEventArgs.cs
- InternalMappingException.cs
- InternalsVisibleToAttribute.cs
- PackWebRequestFactory.cs
- ELinqQueryState.cs
- ComponentDispatcherThread.cs
- DecimalAnimation.cs
- BooleanFacetDescriptionElement.cs
- BindingCollection.cs
- XPathItem.cs
- PagesSection.cs
- ToolStripComboBox.cs
- ItemContainerProviderWrapper.cs
- Point4DValueSerializer.cs
- ICspAsymmetricAlgorithm.cs
- Deflater.cs
- HealthMonitoringSection.cs
- SqlUDTStorage.cs
- DrawingImage.cs
- NullableBoolConverter.cs
- SpotLight.cs
- XPathNodePointer.cs
- PathTooLongException.cs
- GifBitmapEncoder.cs
- PromptEventArgs.cs
- MonitoringDescriptionAttribute.cs
- ResourceKey.cs
- nulltextcontainer.cs
- FixedSOMElement.cs
- CaretElement.cs
- HtmlTableRow.cs
- EntityTransaction.cs
- DesignerView.xaml.cs
- DebugView.cs
- HMACSHA384.cs
- HttpListenerRequest.cs
- BindingUtils.cs
- SqlTypeConverter.cs
- EventProviderTraceListener.cs
- PersonalizablePropertyEntry.cs
- XhtmlBasicObjectListAdapter.cs
- LookupNode.cs
- MemberDescriptor.cs
- EnumBuilder.cs
- LinqMaximalSubtreeNominator.cs
- ProfileSettingsCollection.cs
- SqlServices.cs
- SiteMapDataSourceView.cs
- LicenseManager.cs
- BitmapScalingModeValidation.cs
- DataExpression.cs
- HtmlTableCellCollection.cs
- TimeManager.cs
- DataServiceConfiguration.cs
- BitmapEffect.cs
- DataGridToolTip.cs
- RoleGroupCollection.cs
- ByteAnimation.cs
- StaticContext.cs
- OleDbConnectionInternal.cs
- COM2IDispatchConverter.cs
- CheckBox.cs
- ConnectivityStatus.cs
- PartialCachingAttribute.cs
- HuffModule.cs
- StorageRoot.cs
- SafeThemeHandle.cs
- CreateRefExpr.cs
- TdsParserStaticMethods.cs
- HandledMouseEvent.cs
- PagesSection.cs
- XmlSchemaNotation.cs
- ClientOptions.cs
- DateTimePickerDesigner.cs