Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / WebSysDefaultValueAttribute.cs / 1 / WebSysDefaultValueAttribute.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web {
using System;
using System.ComponentModel;
[AttributeUsage(AttributeTargets.All)]
internal sealed class WebSysDefaultValueAttribute : DefaultValueAttribute {
private Type _type;
private bool _localized;
internal WebSysDefaultValueAttribute(Type type, string value) : base(value) {
_type = type;
}
internal WebSysDefaultValueAttribute(string value) : base(value) { }
public override object TypeId {
get {
return typeof(DefaultValueAttribute);
}
}
public override object Value {
get {
if (!_localized) {
_localized = true;
string baseValue = (string)base.Value;
if (!String.IsNullOrEmpty(baseValue)) {
object value = SR.GetString(baseValue);
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.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web {
using System;
using System.ComponentModel;
[AttributeUsage(AttributeTargets.All)]
internal sealed class WebSysDefaultValueAttribute : DefaultValueAttribute {
private Type _type;
private bool _localized;
internal WebSysDefaultValueAttribute(Type type, string value) : base(value) {
_type = type;
}
internal WebSysDefaultValueAttribute(string value) : base(value) { }
public override object TypeId {
get {
return typeof(DefaultValueAttribute);
}
}
public override object Value {
get {
if (!_localized) {
_localized = true;
string baseValue = (string)base.Value;
if (!String.IsNullOrEmpty(baseValue)) {
object value = SR.GetString(baseValue);
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ButtonRenderer.cs
- indexingfiltermarshaler.cs
- OracleParameterCollection.cs
- XmlSerializer.cs
- RequestContext.cs
- ObjectListDataBindEventArgs.cs
- FrameworkContentElementAutomationPeer.cs
- TemplateNodeContextMenu.cs
- PersonalizablePropertyEntry.cs
- XamlTemplateSerializer.cs
- RankException.cs
- SafePEFileHandle.cs
- ConfigurationProperty.cs
- CodeIdentifier.cs
- AssociationType.cs
- coordinator.cs
- ToolStripHighContrastRenderer.cs
- RawKeyboardInputReport.cs
- ServiceDiscoveryElement.cs
- StrokeFIndices.cs
- ObjectListComponentEditor.cs
- StructuredType.cs
- TransactionBridgeSection.cs
- ChineseLunisolarCalendar.cs
- ButtonField.cs
- BindingList.cs
- PerformanceCountersElement.cs
- VisualStateChangedEventArgs.cs
- CurrencyManager.cs
- CacheModeValueSerializer.cs
- TreeNode.cs
- HostExecutionContextManager.cs
- PrivilegedConfigurationManager.cs
- PolyLineSegmentFigureLogic.cs
- AccessKeyManager.cs
- ExternalFile.cs
- ThreadAbortException.cs
- PlainXmlDeserializer.cs
- FormatterConverter.cs
- RemoteHelper.cs
- HtmlFormWrapper.cs
- WebReferencesBuildProvider.cs
- ViewManagerAttribute.cs
- SecurityPolicySection.cs
- ReliableMessagingVersion.cs
- X509CertificateChain.cs
- ByteAnimationBase.cs
- initElementDictionary.cs
- ExtendedProperty.cs
- MobileControlsSection.cs
- NetPeerTcpBindingCollectionElement.cs
- SymmetricAlgorithm.cs
- PersianCalendar.cs
- PropertyValue.cs
- ItemPager.cs
- ResizeGrip.cs
- DataSourceHelper.cs
- WorkflowRuntimeElement.cs
- AttributedMetaModel.cs
- ConvertBinder.cs
- ZipIOLocalFileBlock.cs
- ConfigXmlElement.cs
- DesignTimeParseData.cs
- AttachedAnnotation.cs
- ClientSettings.cs
- TransformValueSerializer.cs
- AggregatePushdown.cs
- QueryOperator.cs
- GuidelineCollection.cs
- ReversePositionQuery.cs
- UnsafeNativeMethods.cs
- ProcessManager.cs
- SafeFileHandle.cs
- SourceChangedEventArgs.cs
- EndpointAddress10.cs
- StronglyTypedResourceBuilder.cs
- TextServicesManager.cs
- HttpContextServiceHost.cs
- XmlSchemaChoice.cs
- SessionIDManager.cs
- DataSourceViewSchemaConverter.cs
- SqlDeflator.cs
- IisNotInstalledException.cs
- OutOfMemoryException.cs
- FontInfo.cs
- RepeatBehavior.cs
- ManagementEventArgs.cs
- TraceProvider.cs
- HandleExceptionArgs.cs
- Ref.cs
- IntSecurity.cs
- RootProfilePropertySettingsCollection.cs
- UrlMappingsModule.cs
- MenuCommand.cs
- BitVec.cs
- _Rfc2616CacheValidators.cs
- ContentPlaceHolder.cs
- CalendarBlackoutDatesCollection.cs
- ModelPropertyDescriptor.cs
- CompressedStack.cs