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
- SelectionItemPatternIdentifiers.cs
- WaitHandleCannotBeOpenedException.cs
- CodePageUtils.cs
- ReflectEventDescriptor.cs
- AttributeEmitter.cs
- FileUtil.cs
- WmfPlaceableFileHeader.cs
- ConfigurationManager.cs
- WinEventTracker.cs
- XmlResolver.cs
- Stroke.cs
- VisualStyleInformation.cs
- DoubleLinkListEnumerator.cs
- AuthenticationModuleElementCollection.cs
- DockPattern.cs
- URLAttribute.cs
- ConfigXmlCDataSection.cs
- TypefaceCollection.cs
- SuppressMergeCheckAttribute.cs
- MemberHolder.cs
- PersistenceTypeAttribute.cs
- AppDomainProtocolHandler.cs
- ServiceBusyException.cs
- ToolStripEditorManager.cs
- IndexOutOfRangeException.cs
- DrawListViewItemEventArgs.cs
- DispatcherSynchronizationContext.cs
- DropShadowBitmapEffect.cs
- LocalBuilder.cs
- CodeSubDirectoriesCollection.cs
- TaskHelper.cs
- TextEditorCharacters.cs
- TextCharacters.cs
- PathParser.cs
- SqlMetaData.cs
- IconConverter.cs
- XmlExpressionDumper.cs
- ToolStripSeparatorRenderEventArgs.cs
- ViewLoader.cs
- SoapFault.cs
- DataObject.cs
- OdbcConnectionFactory.cs
- ADConnectionHelper.cs
- ForeignConstraint.cs
- Oid.cs
- ServicePointManager.cs
- Animatable.cs
- DbResourceAllocator.cs
- StrongNamePublicKeyBlob.cs
- SQLInt32.cs
- ResourceSet.cs
- _TimerThread.cs
- DateTimeHelper.cs
- ModelMemberCollection.cs
- PrimitiveList.cs
- EncoderBestFitFallback.cs
- OperatingSystem.cs
- WorkflowRuntimeServiceElement.cs
- StreamInfo.cs
- XamlToRtfParser.cs
- JsonFormatReaderGenerator.cs
- Exceptions.cs
- DataSvcMapFile.cs
- InternalTypeHelper.cs
- DataListItemEventArgs.cs
- SchemaCollectionCompiler.cs
- RadioButtonBaseAdapter.cs
- RegistrationServices.cs
- AttributeData.cs
- TextSerializer.cs
- EntityDataSourceValidationException.cs
- CodeAttributeDeclarationCollection.cs
- DesignerLoader.cs
- SelectedCellsChangedEventArgs.cs
- KeysConverter.cs
- Parsers.cs
- ProxyWebPartConnectionCollection.cs
- ToolStripGrip.cs
- DeploymentExceptionMapper.cs
- UpdateCompiler.cs
- SecurityResources.cs
- HelpEvent.cs
- ComponentDesigner.cs
- ITreeGenerator.cs
- RtfFormatStack.cs
- ToolStripRenderEventArgs.cs
- XsltConvert.cs
- HttpApplicationStateWrapper.cs
- AssemblyHash.cs
- PeerNameRegistration.cs
- DataKey.cs
- ValidatedControlConverter.cs
- SolidColorBrush.cs
- WebException.cs
- APCustomTypeDescriptor.cs
- ImpersonateTokenRef.cs
- CreateUserWizardStep.cs
- ItemCheckedEvent.cs
- IDataContractSurrogate.cs
- Timer.cs