Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- PrivateFontCollection.cs
- MatrixIndependentAnimationStorage.cs
- WeakHashtable.cs
- AbsoluteQuery.cs
- ListBase.cs
- ToggleProviderWrapper.cs
- XmlQueryCardinality.cs
- XmlWriterSettings.cs
- ReadOnlyDictionary.cs
- TypeConverterHelper.cs
- KeyTime.cs
- ManipulationLogic.cs
- RequestCachingSection.cs
- BinaryParser.cs
- GetLedgerRequest.cs
- BmpBitmapEncoder.cs
- PageRequestManager.cs
- IntersectQueryOperator.cs
- DrawingCollection.cs
- DependentList.cs
- PrivateFontCollection.cs
- DiscoveryInnerClientAdhoc11.cs
- oledbconnectionstring.cs
- ComboBoxRenderer.cs
- TableItemPattern.cs
- TextParentUndoUnit.cs
- DBDataPermissionAttribute.cs
- NavigateUrlConverter.cs
- GatewayDefinition.cs
- VerificationAttribute.cs
- Cursors.cs
- CrossSiteScriptingValidation.cs
- InvalidTimeZoneException.cs
- LinqDataSourceUpdateEventArgs.cs
- ProtectedProviderSettings.cs
- TabControlAutomationPeer.cs
- PolicyLevel.cs
- WizardSideBarListControlItem.cs
- SEHException.cs
- NavigationProperty.cs
- DataGridViewCellStyleConverter.cs
- ADMembershipProvider.cs
- ModelPropertyDescriptor.cs
- StringCollectionMarkupSerializer.cs
- CellTreeSimplifier.cs
- InputLanguageEventArgs.cs
- SQLDoubleStorage.cs
- CopyEncoder.cs
- MailAddress.cs
- ObjectHandle.cs
- TemplatePagerField.cs
- RegexInterpreter.cs
- CssTextWriter.cs
- TypedRowGenerator.cs
- HtmlUtf8RawTextWriter.cs
- StyleBamlRecordReader.cs
- CodePageEncoding.cs
- URLAttribute.cs
- UpdatePanelControlTrigger.cs
- BCLDebug.cs
- SignatureGenerator.cs
- ServiceBehaviorAttribute.cs
- StateWorkerRequest.cs
- TemplateComponentConnector.cs
- NavigateEvent.cs
- AssertSection.cs
- WebUtility.cs
- TypeConverterAttribute.cs
- PerfCounters.cs
- RootBuilder.cs
- DataServiceRequest.cs
- TableCellAutomationPeer.cs
- ContextActivityUtils.cs
- InvalidateEvent.cs
- ArgumentDesigner.xaml.cs
- SecurityResources.cs
- TableItemStyle.cs
- NotifyIcon.cs
- ResourceDescriptionAttribute.cs
- ProviderSettingsCollection.cs
- TypeCollectionPropertyEditor.cs
- BufferModeSettings.cs
- RoleGroupCollection.cs
- InstanceHandleReference.cs
- XmlBinaryReaderSession.cs
- DataSourceCache.cs
- _NTAuthentication.cs
- WCFBuildProvider.cs
- AesManaged.cs
- MergeLocalizationDirectives.cs
- TextEditor.cs
- UInt32Converter.cs
- MaskedTextProvider.cs
- _StreamFramer.cs
- NTAccount.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- altserialization.cs
- ConnectionManagementElementCollection.cs
- ResourceExpressionBuilder.cs
- XamlContextStack.cs