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
- CheckBoxRenderer.cs
- BitmapEffectGroup.cs
- DataSourceView.cs
- Hyperlink.cs
- RepeaterDesigner.cs
- Simplifier.cs
- KeyedHashAlgorithm.cs
- ParenthesizePropertyNameAttribute.cs
- DesignerAttributeInfo.cs
- AttributeUsageAttribute.cs
- DataControlFieldHeaderCell.cs
- DataContractSerializerOperationFormatter.cs
- TextRenderer.cs
- InvocationExpression.cs
- Cursor.cs
- DbSetClause.cs
- GenerateScriptTypeAttribute.cs
- MediaElement.cs
- ConfigurationSection.cs
- LogRecordSequence.cs
- SimpleHandlerBuildProvider.cs
- StrongName.cs
- ReliableChannelListener.cs
- GlobalizationAssembly.cs
- SafeFindHandle.cs
- ObjectManager.cs
- MouseWheelEventArgs.cs
- SQLSingleStorage.cs
- ImpersonationOption.cs
- TripleDESCryptoServiceProvider.cs
- RightsManagementPermission.cs
- ipaddressinformationcollection.cs
- ReadOnlyCollectionBase.cs
- DllNotFoundException.cs
- SessionState.cs
- CompositeFontInfo.cs
- AdCreatedEventArgs.cs
- TaskHelper.cs
- StylusPointProperties.cs
- DataGridViewCellValidatingEventArgs.cs
- TextSelectionHighlightLayer.cs
- OdbcHandle.cs
- PieceDirectory.cs
- CodeTypeOfExpression.cs
- HelpInfo.cs
- RequiredFieldValidator.cs
- ConfigurationManagerInternal.cs
- TracingConnection.cs
- UserControlCodeDomTreeGenerator.cs
- XPathAxisIterator.cs
- RemoteWebConfigurationHostServer.cs
- Throw.cs
- TableParaClient.cs
- SamlAuthenticationClaimResource.cs
- EntityConnection.cs
- PerformanceCounterLib.cs
- ScriptDescriptor.cs
- SerializationInfoEnumerator.cs
- HtmlInputCheckBox.cs
- XpsFilter.cs
- ToolStripSeparator.cs
- Stack.cs
- ZoomPercentageConverter.cs
- ReflectionUtil.cs
- IPGlobalProperties.cs
- MetafileEditor.cs
- FormViewInsertEventArgs.cs
- SerialErrors.cs
- DataControlFieldHeaderCell.cs
- shaper.cs
- EdmComplexPropertyAttribute.cs
- XmlEventCache.cs
- MenuTracker.cs
- PixelShader.cs
- Highlights.cs
- ReadOnlyDataSource.cs
- SharedConnectionWorkflowTransactionService.cs
- StrongNameUtility.cs
- TableRowCollection.cs
- AssemblyBuilder.cs
- MobileControlDesigner.cs
- DataService.cs
- ClientSettings.cs
- RoutingService.cs
- HttpModulesSection.cs
- XmlSchemaExporter.cs
- DefaultMemberAttribute.cs
- IncrementalCompileAnalyzer.cs
- CodeCatchClauseCollection.cs
- Subtree.cs
- SetterBase.cs
- DynamicActionMessageFilter.cs
- ScrollBar.cs
- TextWriterEngine.cs
- XmlElementCollection.cs
- XmlDocument.cs
- ConstraintManager.cs
- ClipboardData.cs
- ProfileBuildProvider.cs
- Int32RectValueSerializer.cs