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
- Item.cs
- WebCategoryAttribute.cs
- SqlNamer.cs
- ThicknessAnimationUsingKeyFrames.cs
- BaseValidator.cs
- ProfileEventArgs.cs
- InputBinder.cs
- ComEventsInfo.cs
- CallContext.cs
- IListConverters.cs
- MimeTypeAttribute.cs
- StringPropertyBuilder.cs
- DispatcherHooks.cs
- ErrorHandlingAcceptor.cs
- CharConverter.cs
- Helper.cs
- FileInfo.cs
- WindowsSecurityTokenAuthenticator.cs
- CollectionChangedEventManager.cs
- ToolStripGrip.cs
- RadioButtonBaseAdapter.cs
- UserControlBuildProvider.cs
- AddInStore.cs
- DnsCache.cs
- Compensate.cs
- DataServiceRequestException.cs
- SecUtil.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- AsymmetricAlgorithm.cs
- ComponentResourceKeyConverter.cs
- NamedPipeTransportSecurityElement.cs
- DirectoryNotFoundException.cs
- ItemCollection.cs
- FacetChecker.cs
- SerialStream.cs
- DecoderReplacementFallback.cs
- SessionStateSection.cs
- TransactionValidationBehavior.cs
- WindowsFormsHostPropertyMap.cs
- XmlTextReaderImpl.cs
- DeferredSelectedIndexReference.cs
- SoapCodeExporter.cs
- Trace.cs
- GridViewCancelEditEventArgs.cs
- SqlConnection.cs
- KnownIds.cs
- TreeWalkHelper.cs
- EdmFunction.cs
- DataSourceSelectArguments.cs
- Int64KeyFrameCollection.cs
- AudioFileOut.cs
- PropertyManager.cs
- GridErrorDlg.cs
- GeometryHitTestParameters.cs
- BrushMappingModeValidation.cs
- ObjectRef.cs
- TimerTable.cs
- ConstructorExpr.cs
- IIS7UserPrincipal.cs
- ListViewTableRow.cs
- ColumnWidthChangedEvent.cs
- BaseCodeDomTreeGenerator.cs
- WorkflowApplicationException.cs
- CapabilitiesState.cs
- SimpleMailWebEventProvider.cs
- SqlCacheDependencyDatabaseCollection.cs
- NonClientArea.cs
- NamespaceMapping.cs
- HebrewCalendar.cs
- GridItemCollection.cs
- FixedSOMPageElement.cs
- DetailsViewRow.cs
- BuildProviderCollection.cs
- HTTPNotFoundHandler.cs
- SqlDataSourceCommandEventArgs.cs
- SchemaNamespaceManager.cs
- AxHostDesigner.cs
- ConfigXmlWhitespace.cs
- HtmlButton.cs
- OpenTypeLayout.cs
- EventHandlerService.cs
- DesignerLoader.cs
- RsaSecurityToken.cs
- XamlPathDataSerializer.cs
- CheckBox.cs
- LinqDataSourceUpdateEventArgs.cs
- ZoneLinkButton.cs
- ProcessModelInfo.cs
- ConsoleCancelEventArgs.cs
- SafeRegistryHandle.cs
- VSWCFServiceContractGenerator.cs
- DllNotFoundException.cs
- WeakKeyDictionary.cs
- PathParser.cs
- XmlElementAttribute.cs
- Function.cs
- ListManagerBindingsCollection.cs
- XmlAttribute.cs
- GetLedgerRequest.cs
- XmlSchemaSimpleTypeList.cs