Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Configuration / System / Configuration / TypeNameConverter.cs / 1 / TypeNameConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; namespace System.Configuration { public sealed class TypeNameConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { // Make the check here since for some reason value.GetType is not System.Type but RuntimeType if (!(value is Type)) { ValidateType(value, typeof(Type)); } string result = null; if (value != null) { result = ((Type)value).AssemblyQualifiedName; } return result; } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { Type result = TypeUtil.GetTypeWithReflectionPermission((string)data, false); if (result == null) { throw new ArgumentException(SR.GetString(SR.Type_cannot_be_resolved, (string)data)); } return result; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; namespace System.Configuration { public sealed class TypeNameConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { // Make the check here since for some reason value.GetType is not System.Type but RuntimeType if (!(value is Type)) { ValidateType(value, typeof(Type)); } string result = null; if (value != null) { result = ((Type)value).AssemblyQualifiedName; } return result; } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { Type result = TypeUtil.GetTypeWithReflectionPermission((string)data, false); if (result == null) { throw new ArgumentException(SR.GetString(SR.Type_cannot_be_resolved, (string)data)); } return result; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XamlPoint3DCollectionSerializer.cs
- NameValueConfigurationCollection.cs
- XmlILModule.cs
- HttpGetServerProtocol.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- Bezier.cs
- UnmanagedMemoryStreamWrapper.cs
- LoginUtil.cs
- NamespaceQuery.cs
- IHttpResponseInternal.cs
- ServiceOperationListItemList.cs
- Header.cs
- TracingConnectionListener.cs
- SelectedDatesCollection.cs
- IxmlLineInfo.cs
- ConnectionConsumerAttribute.cs
- DependencyPropertyKind.cs
- ToolboxItemFilterAttribute.cs
- ImageMapEventArgs.cs
- RuleInfoComparer.cs
- HttpResponseInternalWrapper.cs
- IDQuery.cs
- TemplatedAdorner.cs
- PermissionRequestEvidence.cs
- DbUpdateCommandTree.cs
- MailMessage.cs
- ProcessModule.cs
- SingleAnimationBase.cs
- DBSchemaTable.cs
- BindingFormattingDialog.cs
- TextElementCollection.cs
- PartialCachingControl.cs
- KeyedPriorityQueue.cs
- PassportAuthenticationEventArgs.cs
- InvalidProgramException.cs
- RIPEMD160Managed.cs
- NotifyParentPropertyAttribute.cs
- ObjectDataSourceSelectingEventArgs.cs
- ValueTable.cs
- DataRelationPropertyDescriptor.cs
- PointCollectionValueSerializer.cs
- PropertyGeneratedEventArgs.cs
- Transform.cs
- NativeMethods.cs
- SByte.cs
- HttpModuleActionCollection.cs
- HtmlTableRowCollection.cs
- StringFreezingAttribute.cs
- DataGridViewSelectedRowCollection.cs
- SelectionService.cs
- DrawTreeNodeEventArgs.cs
- RegularExpressionValidator.cs
- Form.cs
- StorageComplexTypeMapping.cs
- DebugView.cs
- HierarchicalDataSourceControl.cs
- BitmapMetadataBlob.cs
- DesignParameter.cs
- webeventbuffer.cs
- Helpers.cs
- ValidationManager.cs
- UInt32Converter.cs
- SecurityTokenTypes.cs
- PrintPreviewGraphics.cs
- ConfigXmlSignificantWhitespace.cs
- Menu.cs
- ClientSettingsStore.cs
- SafeSystemMetrics.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- ProjectionPathBuilder.cs
- SynchronizedInputPattern.cs
- SemaphoreSecurity.cs
- CallbackHandler.cs
- EnumBuilder.cs
- WebScriptServiceHost.cs
- CLSCompliantAttribute.cs
- XmlValidatingReader.cs
- GenericAuthenticationEventArgs.cs
- ClientSettingsSection.cs
- Int32Collection.cs
- SourceElementsCollection.cs
- WebPartsSection.cs
- ResourceReferenceExpression.cs
- XamlClipboardData.cs
- StatusBarItem.cs
- DataServiceHostFactory.cs
- UpdateRecord.cs
- VectorKeyFrameCollection.cs
- BinaryObjectWriter.cs
- PersistenceTypeAttribute.cs
- XmlSchemaType.cs
- ResourcePool.cs
- PolicyFactory.cs
- WorkflowElementDialogWindow.xaml.cs
- OuterGlowBitmapEffect.cs
- ComponentEvent.cs
- FormatterServices.cs
- SymbolType.cs
- GetImportedCardRequest.cs
- Visual.cs