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
- ReachUIElementCollectionSerializer.cs
- DataGridViewAdvancedBorderStyle.cs
- EntityCollection.cs
- PersonalizationProviderHelper.cs
- ErrorHandlerModule.cs
- ItemCollection.cs
- CodeSubDirectory.cs
- Signature.cs
- SessionStateContainer.cs
- ContextProperty.cs
- HScrollBar.cs
- MulticastDelegate.cs
- BaseTemplateParser.cs
- HScrollBar.cs
- WmlLinkAdapter.cs
- ColumnMapTranslator.cs
- HttpWebRequestElement.cs
- XmlIncludeAttribute.cs
- PersonalizablePropertyEntry.cs
- SelectionGlyph.cs
- ActivitySurrogate.cs
- Image.cs
- ToolStripSettings.cs
- InkCanvas.cs
- ImageListStreamer.cs
- RawKeyboardInputReport.cs
- ClientFormsAuthenticationCredentials.cs
- PaginationProgressEventArgs.cs
- BaseHashHelper.cs
- Method.cs
- ContextStack.cs
- ReadOnlyMetadataCollection.cs
- FileCodeGroup.cs
- Soap.cs
- ActivityBuilderHelper.cs
- DataGridViewLinkCell.cs
- GeneralTransform2DTo3D.cs
- GradientStopCollection.cs
- Message.cs
- UnsafeNativeMethods.cs
- Help.cs
- HttpRuntime.cs
- DataGridViewRowCancelEventArgs.cs
- TransactedReceiveScope.cs
- RandomDelaySendsAsyncResult.cs
- TdsParserSafeHandles.cs
- SwitchAttribute.cs
- XmlSchemaObject.cs
- RegexCode.cs
- PageThemeBuildProvider.cs
- SizeChangedEventArgs.cs
- MouseCaptureWithinProperty.cs
- ExclusiveHandle.cs
- HitTestParameters.cs
- sapiproxy.cs
- GuidelineCollection.cs
- FileUtil.cs
- BitmapSourceSafeMILHandle.cs
- XmlSerializerSection.cs
- HierarchicalDataBoundControlAdapter.cs
- DeobfuscatingStream.cs
- PathFigureCollection.cs
- _HelperAsyncResults.cs
- WindowsListViewItemStartMenu.cs
- AuthStoreRoleProvider.cs
- EntityCommandCompilationException.cs
- LocatorManager.cs
- DiscardableAttribute.cs
- SapiGrammar.cs
- XmlCodeExporter.cs
- RightsManagementInformation.cs
- HMAC.cs
- SqlFunctionAttribute.cs
- CodeTypeParameterCollection.cs
- StorageAssociationTypeMapping.cs
- ToolStripSplitButton.cs
- _UriSyntax.cs
- DataMemberAttribute.cs
- PropertyInformationCollection.cs
- VectorValueSerializer.cs
- SByteConverter.cs
- _BufferOffsetSize.cs
- WebHttpBindingCollectionElement.cs
- TileBrush.cs
- MasterPage.cs
- AspNetSynchronizationContext.cs
- ValidationRule.cs
- CompletedAsyncResult.cs
- ResizeGrip.cs
- AutomationIdentifier.cs
- CqlErrorHelper.cs
- HighContrastHelper.cs
- SynchronizedPool.cs
- FragmentQueryProcessor.cs
- Rotation3DAnimationUsingKeyFrames.cs
- SecurityDocument.cs
- TabControl.cs
- ZipIORawDataFileBlock.cs
- Transform.cs
- COM2PictureConverter.cs