Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Markup / StaticExtensionConverter.cs / 1 / StaticExtensionConverter.cs
//------------------------------------------------------------------------
//
// Microsoft Windows Client Platform
// Copyright (C) Microsoft Corporation, 2005
//
// File: StaticExtensionConverter.cs
//
// Contents: Converter to convert StaticExtensions 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 StaticExtensionConverter : 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 StaticExtension, not an arbitrary class
///
[SecurityCritical, SecurityTreatAsSafe]
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(InstanceDescriptor))
{
StaticExtension staticExtension = value as StaticExtension;
if (staticExtension == null)
throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "StaticExtension"));
return new InstanceDescriptor(typeof(StaticExtension).GetConstructor(new Type[] { typeof(string) }),
new object[] { staticExtension.Member });
}
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
- SessionStateModule.cs
- DiscoveryClientElement.cs
- ApplyImportsAction.cs
- XmlSchemaSimpleTypeList.cs
- PasswordBox.cs
- ToolStripMenuItem.cs
- UnsafeNativeMethodsMilCoreApi.cs
- Win32Native.cs
- SQLBinaryStorage.cs
- DataBoundControlDesigner.cs
- ReferenceService.cs
- MsmqIntegrationProcessProtocolHandler.cs
- DesignerActionTextItem.cs
- WmfPlaceableFileHeader.cs
- WebConfigurationFileMap.cs
- DoubleKeyFrameCollection.cs
- IconConverter.cs
- Scalars.cs
- DataChangedEventManager.cs
- ResourceCollectionInfo.cs
- XmlSiteMapProvider.cs
- RequestCachePolicyConverter.cs
- PassportAuthenticationModule.cs
- Rectangle.cs
- BrowserCapabilitiesCompiler.cs
- ExpandCollapseProviderWrapper.cs
- GPPOINT.cs
- HandledMouseEvent.cs
- SqlAliaser.cs
- SpecialFolderEnumConverter.cs
- GridPattern.cs
- XhtmlConformanceSection.cs
- OrderByLifter.cs
- OutputCacheProfile.cs
- X509CertificateTrustedIssuerElementCollection.cs
- PrtTicket_Public.cs
- ToolBar.cs
- PasswordBoxAutomationPeer.cs
- SafeRegistryHandle.cs
- TreeNodeStyle.cs
- WindowsListViewGroup.cs
- ToolboxDataAttribute.cs
- IApplicationTrustManager.cs
- _IPv6Address.cs
- Operator.cs
- EmptyEnumerator.cs
- GeometryHitTestParameters.cs
- HttpTransportSecurityElement.cs
- DrawListViewItemEventArgs.cs
- DependencyPropertyConverter.cs
- SharedPersonalizationStateInfo.cs
- ExternalCalls.cs
- State.cs
- XmlSchemaAnyAttribute.cs
- FlowDocumentReaderAutomationPeer.cs
- IItemContainerGenerator.cs
- ComponentEditorPage.cs
- ColorPalette.cs
- DbConnectionOptions.cs
- Label.cs
- InternalDispatchObject.cs
- ProviderConnectionPointCollection.cs
- AuthenticateEventArgs.cs
- XslCompiledTransform.cs
- UnionExpr.cs
- D3DImage.cs
- FormatException.cs
- UnicastIPAddressInformationCollection.cs
- DataListCommandEventArgs.cs
- SoapEnvelopeProcessingElement.cs
- TypeConverterHelper.cs
- EmptyImpersonationContext.cs
- ContextMenuAutomationPeer.cs
- Clock.cs
- SystemColors.cs
- SerializationIncompleteException.cs
- ResourceExpressionEditorSheet.cs
- DynamicHyperLink.cs
- SendContent.cs
- DrawingState.cs
- TreeNodeClickEventArgs.cs
- StopStoryboard.cs
- OdbcFactory.cs
- TagMapInfo.cs
- XmlElementAttribute.cs
- ParserContext.cs
- ZipIORawDataFileBlock.cs
- ScrollEventArgs.cs
- Point.cs
- StrokeNodeEnumerator.cs
- GestureRecognizer.cs
- Message.cs
- SQLCharsStorage.cs
- XmlSerializerFormatAttribute.cs
- DashStyle.cs
- ExternalException.cs
- OdbcConnectionPoolProviderInfo.cs
- FixedMaxHeap.cs
- XmlTextReaderImplHelpers.cs
- DataRowChangeEvent.cs