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
- SQLString.cs
- XmlAggregates.cs
- EventRecordWrittenEventArgs.cs
- AnonymousIdentificationSection.cs
- HtmlElement.cs
- GridView.cs
- DoubleStorage.cs
- SessionEndedEventArgs.cs
- dbenumerator.cs
- VoiceSynthesis.cs
- HttpCacheVary.cs
- ReflectionTypeLoadException.cs
- WindowsGraphicsCacheManager.cs
- PassportPrincipal.cs
- CryptoProvider.cs
- RadioButton.cs
- CompilerTypeWithParams.cs
- listviewsubitemcollectioneditor.cs
- VerificationAttribute.cs
- SHA1CryptoServiceProvider.cs
- NonceToken.cs
- RestHandler.cs
- ExternalException.cs
- EventSinkActivityDesigner.cs
- EventBookmark.cs
- OpacityConverter.cs
- WebControlsSection.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- XmlSchemaSequence.cs
- SqlException.cs
- ContainerVisual.cs
- WrapPanel.cs
- SID.cs
- SoundPlayer.cs
- ProviderConnectionPoint.cs
- TraceUtility.cs
- GeneralTransform3DGroup.cs
- StorageEntityTypeMapping.cs
- NetworkAddressChange.cs
- RuleSettings.cs
- DotExpr.cs
- ProcessHost.cs
- GradientSpreadMethodValidation.cs
- LicenseProviderAttribute.cs
- IPipelineRuntime.cs
- ConditionalAttribute.cs
- ToolStripDropDownMenu.cs
- CqlLexer.cs
- Block.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- GACIdentityPermission.cs
- WindowsTab.cs
- StandardBindingOptionalReliableSessionElement.cs
- SqlDataSourceSelectingEventArgs.cs
- SecurityManager.cs
- Bitmap.cs
- FrameworkContentElementAutomationPeer.cs
- Encoder.cs
- PointAnimationUsingPath.cs
- HotSpotCollectionEditor.cs
- EmptyCollection.cs
- TreeViewBindingsEditorForm.cs
- Set.cs
- CleanUpVirtualizedItemEventArgs.cs
- EntityParameterCollection.cs
- WindowsImpersonationContext.cs
- InstanceDataCollectionCollection.cs
- ResourceDescriptionAttribute.cs
- PageAsyncTaskManager.cs
- LogPolicy.cs
- PropertyReferenceExtension.cs
- RenderContext.cs
- Panel.cs
- SettingsSavedEventArgs.cs
- WindowsListView.cs
- SqlUnionizer.cs
- AuthorizationRule.cs
- AffineTransform3D.cs
- EventBookmark.cs
- DynamicPropertyHolder.cs
- ToolZone.cs
- XpsFilter.cs
- PauseStoryboard.cs
- BindingExpressionBase.cs
- MultiAsyncResult.cs
- TemplateControl.cs
- KeyboardEventArgs.cs
- CodeSnippetTypeMember.cs
- DetailsViewModeEventArgs.cs
- TypeBrowserDialog.cs
- CommonGetThemePartSize.cs
- CompatibleComparer.cs
- SchemaTypeEmitter.cs
- ReaderWriterLock.cs
- SqlNodeAnnotations.cs
- RegexCharClass.cs
- GridProviderWrapper.cs
- CallbackBehaviorAttribute.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- QueryActivatableWorkflowsCommand.cs