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
- QueryContext.cs
- TableLayoutPanelDesigner.cs
- CharacterHit.cs
- MailAddressParser.cs
- COM2ICategorizePropertiesHandler.cs
- RightsManagementEncryptionTransform.cs
- __ConsoleStream.cs
- ToolStripGrip.cs
- StackOverflowException.cs
- XmlEventCache.cs
- DownloadProgressEventArgs.cs
- RowType.cs
- MetadataPropertyvalue.cs
- BamlResourceSerializer.cs
- VectorAnimationUsingKeyFrames.cs
- HwndSourceParameters.cs
- XmlSchemaCollection.cs
- OperationCanceledException.cs
- SystemResourceKey.cs
- UserInitiatedRoutedEventPermission.cs
- IsolatedStorage.cs
- SectionInput.cs
- NonParentingControl.cs
- TopClause.cs
- XmlUrlResolver.cs
- TextFormatter.cs
- ListChangedEventArgs.cs
- LinkButton.cs
- XmlArrayItemAttribute.cs
- FileStream.cs
- HotSpotCollectionEditor.cs
- WindowsFormsHostAutomationPeer.cs
- EpmHelper.cs
- ClientOptions.cs
- UserValidatedEventArgs.cs
- CreationContext.cs
- Win32.cs
- EventLogTraceListener.cs
- OptimalTextSource.cs
- DispatcherHookEventArgs.cs
- PlainXmlSerializer.cs
- ComNativeDescriptor.cs
- MSAAEventDispatcher.cs
- Avt.cs
- ViewStateModeByIdAttribute.cs
- SmtpTransport.cs
- ItemCollection.cs
- Adorner.cs
- CacheVirtualItemsEvent.cs
- Size.cs
- HealthMonitoringSectionHelper.cs
- BindStream.cs
- ApplicationBuildProvider.cs
- URLIdentityPermission.cs
- OdbcPermission.cs
- OperationCanceledException.cs
- InternalMappingException.cs
- CompilerGeneratedAttribute.cs
- ButtonBaseAutomationPeer.cs
- AssemblySettingAttributes.cs
- RowsCopiedEventArgs.cs
- RegistryPermission.cs
- ConfigurationFileMap.cs
- RSATokenProvider.cs
- DataObjectPastingEventArgs.cs
- UriParserTemplates.cs
- Composition.cs
- NavigationWindowAutomationPeer.cs
- MsmqIntegrationOutputChannel.cs
- _NegoStream.cs
- DbConnectionPoolGroup.cs
- ColumnWidthChangingEvent.cs
- BrowserTree.cs
- ListenerTraceUtility.cs
- ZipPackage.cs
- AccessControlList.cs
- StyleHelper.cs
- FontFamilyConverter.cs
- PermissionRequestEvidence.cs
- WebConfigurationFileMap.cs
- Visual3DCollection.cs
- LOSFormatter.cs
- UnsafeNativeMethods.cs
- WindowsRegion.cs
- FormatPage.cs
- ChangeToolStripParentVerb.cs
- BindingsCollection.cs
- ImplicitInputBrush.cs
- AutomationPropertyInfo.cs
- SmiMetaDataProperty.cs
- Bits.cs
- StyleTypedPropertyAttribute.cs
- CancellationHandler.cs
- SimpleLine.cs
- ListBindableAttribute.cs
- PrinterSettings.cs
- PtsContext.cs
- TextTreeNode.cs
- IisTraceWebEventProvider.cs
- TransformedBitmap.cs