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
- MaskInputRejectedEventArgs.cs
- ToolTipAutomationPeer.cs
- CacheModeConverter.cs
- PropertyTabAttribute.cs
- FontStretch.cs
- ControlValuePropertyAttribute.cs
- HttpCacheParams.cs
- TableDetailsRow.cs
- ResourceReferenceExpression.cs
- ImageCodecInfoPrivate.cs
- PointHitTestParameters.cs
- WorkflowServiceHostFactory.cs
- DrawingState.cs
- RtfToXamlLexer.cs
- HtmlElementErrorEventArgs.cs
- DocobjHost.cs
- IndexedSelectQueryOperator.cs
- sqlstateclientmanager.cs
- ResourceManager.cs
- SqlRowUpdatingEvent.cs
- SelectingProviderEventArgs.cs
- WebHttpBindingElement.cs
- safemediahandle.cs
- XmlDocumentFieldSchema.cs
- InfoCardArgumentException.cs
- FrameworkContentElement.cs
- RegisteredArrayDeclaration.cs
- RuleInfoComparer.cs
- DataGridViewDataErrorEventArgs.cs
- ExpressionBindingCollection.cs
- VersionedStreamOwner.cs
- StandardCommands.cs
- IisHelper.cs
- CodeLinePragma.cs
- hresults.cs
- GeneralTransform3DTo2D.cs
- ToolStripOverflow.cs
- Int64Animation.cs
- RunWorkerCompletedEventArgs.cs
- XmlIncludeAttribute.cs
- Matrix.cs
- SapiGrammar.cs
- SerializationException.cs
- EntityDesignerDataSourceView.cs
- InstallerTypeAttribute.cs
- CountAggregationOperator.cs
- ComponentResourceKeyConverter.cs
- RegexStringValidatorAttribute.cs
- OciEnlistContext.cs
- ResourceSet.cs
- PersonalizationProviderHelper.cs
- DataRelation.cs
- _Semaphore.cs
- TimeIntervalCollection.cs
- VSWCFServiceContractGenerator.cs
- InputLangChangeRequestEvent.cs
- ToolBarTray.cs
- UTF8Encoding.cs
- SizeFConverter.cs
- ToolStripStatusLabel.cs
- MetadataItemEmitter.cs
- ScrollItemPattern.cs
- GridView.cs
- RefreshPropertiesAttribute.cs
- SolidColorBrush.cs
- OracleColumn.cs
- ClockGroup.cs
- CodePrimitiveExpression.cs
- SQLBytesStorage.cs
- RoutingBehavior.cs
- AsyncPostBackTrigger.cs
- XmlCodeExporter.cs
- DataSetMappper.cs
- RuntimeVariableList.cs
- SubpageParagraph.cs
- EntityDataSourceValidationException.cs
- CustomAttributeBuilder.cs
- FtpRequestCacheValidator.cs
- BooleanStorage.cs
- Membership.cs
- NonBatchDirectoryCompiler.cs
- LinqDataSourceStatusEventArgs.cs
- ToolTipAutomationPeer.cs
- BindingOperations.cs
- Predicate.cs
- KeyValueSerializer.cs
- VersionPair.cs
- WindowsFormsHost.cs
- BridgeDataReader.cs
- DataSourceView.cs
- SerialPinChanges.cs
- ThreadExceptionEvent.cs
- PolicyManager.cs
- BindingsCollection.cs
- StructuralType.cs
- MatrixTransform.cs
- ADRoleFactoryConfiguration.cs
- EditorPart.cs
- XmlMembersMapping.cs
- BaseTemplateParser.cs