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
- xmlsaver.cs
- _FixedSizeReader.cs
- CoTaskMemHandle.cs
- TypeBuilder.cs
- LineSegment.cs
- CodeNamespaceImport.cs
- DrawingState.cs
- CodeExpressionRuleDeclaration.cs
- SqlUtil.cs
- SerializationFieldInfo.cs
- RectangleHotSpot.cs
- AppDomainManager.cs
- ObjectResult.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- EventTask.cs
- WebBrowser.cs
- ValidationHelpers.cs
- Vector3DCollectionValueSerializer.cs
- QueryContinueDragEvent.cs
- SingleResultAttribute.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- Odbc32.cs
- CodeBinaryOperatorExpression.cs
- WorkflowTimerService.cs
- HttpAsyncResult.cs
- StringArrayEditor.cs
- GZipStream.cs
- PopupControlService.cs
- UnsafeNativeMethods.cs
- ApplicationContext.cs
- DateTimeHelper.cs
- LongValidator.cs
- HttpListenerException.cs
- XamlStyleSerializer.cs
- StoreItemCollection.Loader.cs
- CheckableControlBaseAdapter.cs
- RecordsAffectedEventArgs.cs
- TableRowGroup.cs
- BulletChrome.cs
- ConsumerConnectionPoint.cs
- Site.cs
- XmlLoader.cs
- CngProvider.cs
- OperatorExpressions.cs
- SettingsPropertyValueCollection.cs
- Types.cs
- Inline.cs
- SimpleTypeResolver.cs
- IListConverters.cs
- XmlLanguage.cs
- DelegatingTypeDescriptionProvider.cs
- TableRowCollection.cs
- TypeInformation.cs
- WeakEventManager.cs
- ImagingCache.cs
- XamlPathDataSerializer.cs
- ClassDataContract.cs
- DataTableReader.cs
- PeerEndPoint.cs
- SHA1CryptoServiceProvider.cs
- HttpCapabilitiesEvaluator.cs
- odbcmetadatacolumnnames.cs
- SingleAnimation.cs
- ParameterToken.cs
- QueryFunctions.cs
- XmlNodeChangedEventManager.cs
- FormClosingEvent.cs
- TerminateSequence.cs
- WebConfigurationFileMap.cs
- AssociationProvider.cs
- SiteOfOriginContainer.cs
- Style.cs
- HierarchicalDataTemplate.cs
- BufferBuilder.cs
- DataTableMappingCollection.cs
- HostingPreferredMapPath.cs
- EnumerableRowCollection.cs
- HMAC.cs
- CacheRequest.cs
- SessionStateSection.cs
- IDReferencePropertyAttribute.cs
- XmlSerializableServices.cs
- DnsEndPoint.cs
- JsonWriter.cs
- DoubleConverter.cs
- GridViewCancelEditEventArgs.cs
- Registration.cs
- StringResourceManager.cs
- SqlConnectionString.cs
- VScrollBar.cs
- EventBookmark.cs
- UriTemplateCompoundPathSegment.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- ExtendedProtectionPolicyElement.cs
- URLMembershipCondition.cs
- DebugView.cs
- EntityTransaction.cs
- SourceLocation.cs
- Size3DConverter.cs
- StateMachineWorkflow.cs