Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / DynamicResourceExtensionConverter.cs / 1 / DynamicResourceExtensionConverter.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: ElementItem.cs // // Contents: Implements a converter to an instance descriptor for // DynamicResourceExtension // // Created: 04/28/2005 [....] // //----------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Collections; using System.Security; using System.Text; namespace System.Windows { ////// Type converter to inform the serialization system how to construct a DynamicResourceExtension from /// an instance. It reports that ResourceKey should be used as the first parameter to the constructor. /// public class DynamicResourceExtensionConverter: TypeConverter { ////// True if converting to an instance descriptor /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ////// Converts to an instance descriptor /// ////// Critical: calls InstanceDescriptor ctor which LinkDemands /// PublicOK: can only make an InstanceDescriptor for DynamicResourceExtension, not an arbitrary class /// [SecurityCritical] public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { if(value == null) throw new ArgumentNullException("value"); DynamicResourceExtension dynamicResource = value as DynamicResourceExtension; if (dynamicResource == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "DynamicResourceExtension"), "value"); return new InstanceDescriptor(typeof(DynamicResourceExtension).GetConstructor(new Type[] { typeof(object) }), new object[] { dynamicResource.ResourceKey } ); } 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: ElementItem.cs // // Contents: Implements a converter to an instance descriptor for // DynamicResourceExtension // // Created: 04/28/2005 [....] // //----------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Collections; using System.Security; using System.Text; namespace System.Windows { ////// Type converter to inform the serialization system how to construct a DynamicResourceExtension from /// an instance. It reports that ResourceKey should be used as the first parameter to the constructor. /// public class DynamicResourceExtensionConverter: TypeConverter { ////// True if converting to an instance descriptor /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ////// Converts to an instance descriptor /// ////// Critical: calls InstanceDescriptor ctor which LinkDemands /// PublicOK: can only make an InstanceDescriptor for DynamicResourceExtension, not an arbitrary class /// [SecurityCritical] public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { if(value == null) throw new ArgumentNullException("value"); DynamicResourceExtension dynamicResource = value as DynamicResourceExtension; if (dynamicResource == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "DynamicResourceExtension"), "value"); return new InstanceDescriptor(typeof(DynamicResourceExtension).GetConstructor(new Type[] { typeof(object) }), new object[] { dynamicResource.ResourceKey } ); } 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RegexNode.cs
- TypeToTreeConverter.cs
- RegistryDataKey.cs
- VolatileEnlistmentMultiplexing.cs
- UserValidatedEventArgs.cs
- HtmlFormWrapper.cs
- ThreadStateException.cs
- CodeGen.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- TypeExtension.cs
- TextRangeEditTables.cs
- Domain.cs
- LinqDataSourceDeleteEventArgs.cs
- CannotUnloadAppDomainException.cs
- JsonCollectionDataContract.cs
- WriteableBitmap.cs
- _SpnDictionary.cs
- MergeFailedEvent.cs
- RemotingConfigParser.cs
- NetworkInterface.cs
- ExpressionCopier.cs
- HttpListenerException.cs
- SaveFileDialogDesigner.cs
- Vector3DValueSerializer.cs
- SyndicationItemFormatter.cs
- ColumnResizeAdorner.cs
- WebPartMovingEventArgs.cs
- SQLCharsStorage.cs
- DataService.cs
- CodeExporter.cs
- InProcStateClientManager.cs
- SignedInfo.cs
- PersistStreamTypeWrapper.cs
- CodeTypeConstructor.cs
- WindowsAuthenticationModule.cs
- TimelineCollection.cs
- RemoteHelper.cs
- SelectionChangedEventArgs.cs
- DocumentSchemaValidator.cs
- ObjectListFieldCollection.cs
- NameValuePair.cs
- SerialStream.cs
- TextDocumentView.cs
- wgx_sdk_version.cs
- EnumerableCollectionView.cs
- CompiledIdentityConstraint.cs
- UInt32.cs
- SiteMapDesignerDataSourceView.cs
- PasswordTextContainer.cs
- ToolboxComponentsCreatedEventArgs.cs
- DrawingGroup.cs
- ToolstripProfessionalRenderer.cs
- Point3DAnimationUsingKeyFrames.cs
- XmlEncApr2001.cs
- ExternalFile.cs
- TypeValidationEventArgs.cs
- EventLogTraceListener.cs
- DetailsViewCommandEventArgs.cs
- FastEncoder.cs
- _ListenerAsyncResult.cs
- TypographyProperties.cs
- XsltArgumentList.cs
- HTTPNotFoundHandler.cs
- SqlGatherProducedAliases.cs
- BufferAllocator.cs
- PrintPreviewControl.cs
- DelegatingConfigHost.cs
- CodeGeneratorOptions.cs
- Latin1Encoding.cs
- PlaceHolder.cs
- XmlNodeChangedEventArgs.cs
- SchemaAttDef.cs
- CodeSubDirectory.cs
- TraceSection.cs
- DiagnosticSection.cs
- FusionWrap.cs
- DataStorage.cs
- WrappedReader.cs
- XmlDataSource.cs
- Gdiplus.cs
- ExpressionBindingCollection.cs
- HebrewNumber.cs
- FormattedTextSymbols.cs
- IisHelper.cs
- MetadataItem.cs
- ItemChangedEventArgs.cs
- RectConverter.cs
- RootProfilePropertySettingsCollection.cs
- DayRenderEvent.cs
- HealthMonitoringSection.cs
- TemplateComponentConnector.cs
- WorkflowInstanceUnhandledExceptionRecord.cs
- AsmxEndpointPickerExtension.cs
- ObfuscateAssemblyAttribute.cs
- HandleRef.cs
- ComplexPropertyEntry.cs
- DataGridViewComboBoxCell.cs
- IListConverters.cs
- DBNull.cs
- DataGridTableStyleMappingNameEditor.cs