Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / ResourceDefaultValueAttribute.cs / 1305376 / ResourceDefaultValueAttribute.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.ComponentModel; using System.Reflection; using System.Web.Resources; [AttributeUsage(AttributeTargets.All)] internal sealed class ResourceDefaultValueAttribute : DefaultValueAttribute { private Type _type; private bool _resourceLoaded; internal ResourceDefaultValueAttribute(Type type, string value) : base(value) { _type = type; } internal ResourceDefaultValueAttribute(string value) : base(value) { } public override object TypeId { get { return typeof(DefaultValueAttribute); } } public override object Value { get { if (!_resourceLoaded) { _resourceLoaded = true; string baseValue = (string)base.Value; if (!String.IsNullOrEmpty(baseValue)) { object value = AtlasWeb.ResourceManager.GetString(baseValue, AtlasWeb.Culture); if (_type != null) { try { value = TypeDescriptor.GetConverter(_type).ConvertFromInvariantString((string)value); } catch (NotSupportedException) { value = null; } } base.SetValue(value); } } return base.Value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.ComponentModel; using System.Reflection; using System.Web.Resources; [AttributeUsage(AttributeTargets.All)] internal sealed class ResourceDefaultValueAttribute : DefaultValueAttribute { private Type _type; private bool _resourceLoaded; internal ResourceDefaultValueAttribute(Type type, string value) : base(value) { _type = type; } internal ResourceDefaultValueAttribute(string value) : base(value) { } public override object TypeId { get { return typeof(DefaultValueAttribute); } } public override object Value { get { if (!_resourceLoaded) { _resourceLoaded = true; string baseValue = (string)base.Value; if (!String.IsNullOrEmpty(baseValue)) { object value = AtlasWeb.ResourceManager.GetString(baseValue, AtlasWeb.Culture); if (_type != null) { try { value = TypeDescriptor.GetConverter(_type).ConvertFromInvariantString((string)value); } catch (NotSupportedException) { value = null; } } base.SetValue(value); } } return base.Value; } } } } // 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
- WebBrowserNavigatedEventHandler.cs
- __TransparentProxy.cs
- TypeSystem.cs
- FileChangesMonitor.cs
- InsufficientMemoryException.cs
- InputScopeAttribute.cs
- InstanceCompleteException.cs
- PrintPageEvent.cs
- CompleteWizardStep.cs
- ActivityExecutionContextCollection.cs
- MenuItemBindingCollection.cs
- SecurityDocument.cs
- ReflectionUtil.cs
- PassportAuthenticationEventArgs.cs
- EventMappingSettings.cs
- NullRuntimeConfig.cs
- HttpCacheVary.cs
- CheckBoxField.cs
- HttpProfileBase.cs
- TextSelection.cs
- ColorConvertedBitmapExtension.cs
- ListViewItemEventArgs.cs
- DrawingCollection.cs
- ObjectDataSourceChooseTypePanel.cs
- PointConverter.cs
- StringBuilder.cs
- PointIndependentAnimationStorage.cs
- SrgsDocument.cs
- BamlWriter.cs
- HitTestWithPointDrawingContextWalker.cs
- COM2ColorConverter.cs
- MD5.cs
- ValueTypeFixupInfo.cs
- filewebrequest.cs
- CompositeControl.cs
- FreezableDefaultValueFactory.cs
- ExtentKey.cs
- XmlSecureResolver.cs
- CredentialCache.cs
- EntryIndex.cs
- Command.cs
- Mapping.cs
- ServiceDescriptionImporter.cs
- NavigateUrlConverter.cs
- FilterableData.cs
- VisualBasicHelper.cs
- TdsEnums.cs
- TextContainerChangeEventArgs.cs
- Stream.cs
- TileBrush.cs
- MediaEntryAttribute.cs
- IncrementalHitTester.cs
- BindingsCollection.cs
- ReadOnlyNameValueCollection.cs
- AffineTransform3D.cs
- HttpModuleAction.cs
- DispatcherObject.cs
- MetadataException.cs
- AssemblyBuilder.cs
- DocumentOrderQuery.cs
- ConnectionInterfaceCollection.cs
- CachedFontFamily.cs
- BitmapEffectCollection.cs
- HierarchicalDataSourceControl.cs
- FileDetails.cs
- XsdBuildProvider.cs
- FunctionParameter.cs
- Command.cs
- HttpCapabilitiesEvaluator.cs
- PowerModeChangedEventArgs.cs
- ConfigXmlElement.cs
- AncillaryOps.cs
- BinaryNode.cs
- SafeCryptContextHandle.cs
- GatewayDefinition.cs
- LoginViewDesigner.cs
- PeerNode.cs
- AnnotationDocumentPaginator.cs
- CachingHintValidation.cs
- assemblycache.cs
- XmlUtf8RawTextWriter.cs
- TextParentUndoUnit.cs
- Blend.cs
- ImpersonationContext.cs
- StringCollection.cs
- FormViewRow.cs
- GiveFeedbackEventArgs.cs
- Permission.cs
- ScrollBarRenderer.cs
- SerializationObjectManager.cs
- SqlDataSourceStatusEventArgs.cs
- PersonalizableAttribute.cs
- MenuItemStyleCollection.cs
- RegexParser.cs
- ListViewDataItem.cs
- SqlSupersetValidator.cs
- DesignUtil.cs
- FileSystemWatcher.cs
- TypeDescriptorFilterService.cs
- WorkflowMarkupSerializer.cs