Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Markup / TypeExtensionConverter.cs / 1 / TypeExtensionConverter.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: TypeExtensionConverter.cs // // Contents: Converter to convert TypeExtensions to InstanceDescriptors // Created: 04/28/2005 chuckj // //----------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Collections.Generic; using System.Text; using System.Security; namespace System.Windows.Markup { class TypeExtensionConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ////// Critical: calls InstanceDescriptor ctor which LinkDemands /// TreatAsSafe: can only make an InstanceDescriptor for TypeExtension, not an arbitrary class /// [SecurityCritical, SecurityTreatAsSafe] public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { TypeExtension typeExtension = value as TypeExtension; if (typeExtension == null) { throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TypeExtension")); } return new InstanceDescriptor(typeof(TypeExtension).GetConstructor(new Type[] { typeof(Type) }), new object[] { typeExtension.Type }); } return base.ConvertTo(context, culture, value, destinationType); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpDebugHandler.cs
- SqlDependencyListener.cs
- TextLineBreak.cs
- CodeDOMProvider.cs
- DispatcherExceptionFilterEventArgs.cs
- SharedPerformanceCounter.cs
- MiniCustomAttributeInfo.cs
- SrgsGrammarCompiler.cs
- ToolBarButton.cs
- DataKeyCollection.cs
- SpeechDetectedEventArgs.cs
- SqlProviderManifest.cs
- objectresult_tresulttype.cs
- SAPIEngineTypes.cs
- OdbcCommandBuilder.cs
- IsolatedStorage.cs
- EventMappingSettingsCollection.cs
- StructuralCache.cs
- XmlAttributeAttribute.cs
- XsltSettings.cs
- TextTrailingCharacterEllipsis.cs
- CryptoApi.cs
- ParserHooks.cs
- BindUriHelper.cs
- ToolboxItemAttribute.cs
- RadioButtonBaseAdapter.cs
- DataViewManagerListItemTypeDescriptor.cs
- XPathDocument.cs
- TdsParser.cs
- OracleRowUpdatingEventArgs.cs
- KeyValuePairs.cs
- Errors.cs
- DataGridViewLayoutData.cs
- ConvertTextFrag.cs
- PatternMatcher.cs
- CompositeCollectionView.cs
- ReadOnlyHierarchicalDataSourceView.cs
- StorageEndPropertyMapping.cs
- CodeTypeConstructor.cs
- DateTimeOffsetStorage.cs
- NativeMethodsOther.cs
- SettingsPropertyValue.cs
- GroupQuery.cs
- PointAnimationUsingKeyFrames.cs
- EntitySetRetriever.cs
- RestHandlerFactory.cs
- ToolStripDropDownItemDesigner.cs
- CodeArrayCreateExpression.cs
- TextParagraphProperties.cs
- SQLDateTime.cs
- Style.cs
- ProfileProvider.cs
- RoutingEndpointTrait.cs
- Brushes.cs
- VisualStyleRenderer.cs
- PlacementWorkspace.cs
- CodeParameterDeclarationExpression.cs
- AsynchronousChannel.cs
- StubHelpers.cs
- UniqueIdentifierService.cs
- ParseHttpDate.cs
- BaseHashHelper.cs
- CellParaClient.cs
- GeometryCollection.cs
- WorkflowMarkupSerializationException.cs
- CatalogZoneBase.cs
- DynamicResourceExtensionConverter.cs
- StrokeNodeData.cs
- SafeNativeMethodsMilCoreApi.cs
- ActiveDesignSurfaceEvent.cs
- WorkflowInstance.cs
- DescendantQuery.cs
- MatrixTransform3D.cs
- XomlDesignerLoader.cs
- FixUpCollection.cs
- handlecollector.cs
- IResourceProvider.cs
- ILGenerator.cs
- KerberosSecurityTokenProvider.cs
- ChineseLunisolarCalendar.cs
- X509AudioLogo.cs
- WindowsListBox.cs
- RecipientInfo.cs
- LayoutSettings.cs
- ToolBarButtonClickEvent.cs
- Path.cs
- CodeNamespaceImport.cs
- DnsEndpointIdentity.cs
- IDQuery.cs
- CryptoApi.cs
- NetworkInformationException.cs
- CmsUtils.cs
- MetadataPropertyAttribute.cs
- CompareValidator.cs
- FormsAuthenticationModule.cs
- ContentElement.cs
- RelationshipType.cs
- Button.cs
- SoapProtocolReflector.cs
- Model3DCollection.cs