Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / 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 [....]
//
//-----------------------------------------------------------------------
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.
//------------------------------------------------------------------------
//
// Microsoft Windows Client Platform
// Copyright (C) Microsoft Corporation, 2005
//
// File: StaticExtensionConverter.cs
//
// Contents: Converter to convert StaticExtensions to InstanceDescriptors
// Created: 04/28/2005 [....]
//
//-----------------------------------------------------------------------
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
- ModifierKeysConverter.cs
- FontStretches.cs
- OdbcConnectionOpen.cs
- WindowsListViewScroll.cs
- PriorityQueue.cs
- HttpListenerPrefixCollection.cs
- EventProxy.cs
- Matrix3D.cs
- ReferentialConstraint.cs
- ByteKeyFrameCollection.cs
- GcHandle.cs
- KeySpline.cs
- EdmRelationshipRoleAttribute.cs
- controlskin.cs
- BooleanExpr.cs
- SafeEventLogWriteHandle.cs
- SearchExpression.cs
- ModulesEntry.cs
- HttpContextServiceHost.cs
- WaitHandleCannotBeOpenedException.cs
- ExtensionFile.cs
- QilUnary.cs
- EnumerableCollectionView.cs
- SocketInformation.cs
- nulltextcontainer.cs
- IndexerNameAttribute.cs
- Char.cs
- AnnotationDocumentPaginator.cs
- SqlBooleanizer.cs
- MediaCommands.cs
- AnnotationService.cs
- DataGridItemCollection.cs
- MetricEntry.cs
- SQLSingle.cs
- TextModifier.cs
- Attributes.cs
- ProgressBarAutomationPeer.cs
- BufferedOutputStream.cs
- XmlObjectSerializerReadContextComplexJson.cs
- InstanceData.cs
- DoubleIndependentAnimationStorage.cs
- DataViewSetting.cs
- WebZone.cs
- SAPICategories.cs
- FaultFormatter.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- AxWrapperGen.cs
- SqlGenericUtil.cs
- ApplicationGesture.cs
- ADMembershipUser.cs
- Ops.cs
- Constraint.cs
- DPTypeDescriptorContext.cs
- TablePattern.cs
- HyperLinkStyle.cs
- ColumnWidthChangingEvent.cs
- SystemWebCachingSectionGroup.cs
- PenThreadPool.cs
- MiniAssembly.cs
- DataViewManagerListItemTypeDescriptor.cs
- OutOfMemoryException.cs
- XmlSchemaRedefine.cs
- MulticastDelegate.cs
- TableHeaderCell.cs
- Int32RectConverter.cs
- StandardOleMarshalObject.cs
- EncryptedPackage.cs
- _HelperAsyncResults.cs
- SpecialNameAttribute.cs
- FilterableAttribute.cs
- ADMembershipUser.cs
- SqlMethodCallConverter.cs
- FrameworkElement.cs
- Menu.cs
- PaintValueEventArgs.cs
- NativeMethods.cs
- OutputScopeManager.cs
- Crc32.cs
- StringCollection.cs
- ApplicationHost.cs
- BindingSource.cs
- versioninfo.cs
- Native.cs
- BaseCollection.cs
- FilterableAttribute.cs
- EventMemberCodeDomSerializer.cs
- PackageDigitalSignature.cs
- AccessViolationException.cs
- MemberMaps.cs
- TreeNodeBinding.cs
- XmlParser.cs
- WebHostedComPlusServiceHost.cs
- DataGridViewRow.cs
- SqlMethodCallConverter.cs
- COAUTHIDENTITY.cs
- XDeferredAxisSource.cs
- HttpListenerException.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- LinkedResource.cs
- Pair.cs