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
- UnsafeNativeMethods.cs
- ActivityValidationServices.cs
- ExceptionHandlerDesigner.cs
- Form.cs
- FileDialogPermission.cs
- GeneralTransform2DTo3DTo2D.cs
- NonSerializedAttribute.cs
- entityreference_tresulttype.cs
- NativeMethods.cs
- SplineKeyFrames.cs
- AnnotationResourceChangedEventArgs.cs
- XmlNodeReader.cs
- UnsafeNativeMethods.cs
- PrintControllerWithStatusDialog.cs
- XmlSerializableReader.cs
- TextAdaptor.cs
- MarshalByRefObject.cs
- DispatchWrapper.cs
- StorageSetMapping.cs
- DataColumnPropertyDescriptor.cs
- WindowsNonControl.cs
- ScalarOps.cs
- DataControlButton.cs
- URLEditor.cs
- CoTaskMemSafeHandle.cs
- HMACSHA512.cs
- FormatterServices.cs
- ToolStripMenuItem.cs
- MtomMessageEncodingBindingElement.cs
- EntityClientCacheEntry.cs
- RepeaterItemCollection.cs
- _SSPIWrapper.cs
- NewExpression.cs
- SafeHandles.cs
- UnsafeNativeMethods.cs
- ListViewInsertEventArgs.cs
- UIElementAutomationPeer.cs
- OleDbConnectionFactory.cs
- FixedSOMContainer.cs
- UrlParameterReader.cs
- DispatcherSynchronizationContext.cs
- RemoteWebConfigurationHostServer.cs
- ApplicationSettingsBase.cs
- EmptyCollection.cs
- UnsafeNativeMethodsPenimc.cs
- Vars.cs
- WebPartVerbCollection.cs
- TextContainer.cs
- ResourceDescriptionAttribute.cs
- HandlerFactoryWrapper.cs
- OrderedParallelQuery.cs
- thaishape.cs
- Currency.cs
- RowToFieldTransformer.cs
- CopyAttributesAction.cs
- KeyValueConfigurationCollection.cs
- Inline.cs
- httpserverutility.cs
- RegistryExceptionHelper.cs
- ScrollBarAutomationPeer.cs
- ScrollProperties.cs
- SqlRowUpdatingEvent.cs
- CapiSymmetricAlgorithm.cs
- UrlAuthFailureHandler.cs
- RenderOptions.cs
- KerberosSecurityTokenAuthenticator.cs
- PersonalizableAttribute.cs
- InvokePatternIdentifiers.cs
- JsonDataContract.cs
- SecureUICommand.cs
- WebAdminConfigurationHelper.cs
- SoapTypeAttribute.cs
- ObjectQueryState.cs
- _IPv6Address.cs
- ItemCheckEvent.cs
- CmsUtils.cs
- filewebresponse.cs
- LoadRetryStrategyFactory.cs
- SqlDeflator.cs
- QilFunction.cs
- QueryOutputWriter.cs
- BitmapEffectInputData.cs
- RequestCacheValidator.cs
- TraceShell.cs
- FixedNode.cs
- BindingObserver.cs
- ListenerConnectionDemuxer.cs
- CaseInsensitiveHashCodeProvider.cs
- FileSystemInfo.cs
- Expander.cs
- LookupBindingPropertiesAttribute.cs
- FamilyTypeface.cs
- SchemaAttDef.cs
- XmlHelper.cs
- ColorTypeConverter.cs
- DateTimeFormatInfo.cs
- AssociationTypeEmitter.cs
- Environment.cs
- PerfCounters.cs
- DrawListViewSubItemEventArgs.cs