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
- GeneralTransformGroup.cs
- SvcMapFileLoader.cs
- EdmItemCollection.OcAssemblyCache.cs
- NegotiateStream.cs
- DataServiceRequestOfT.cs
- ListItemsCollectionEditor.cs
- SqlDuplicator.cs
- smtppermission.cs
- PerformanceCounterPermission.cs
- RealizationDrawingContextWalker.cs
- webeventbuffer.cs
- ObjectQueryProvider.cs
- HyperLinkColumn.cs
- NativeMethodsCLR.cs
- ScrollItemProviderWrapper.cs
- NominalTypeEliminator.cs
- FilterableAttribute.cs
- ConnectionStringSettingsCollection.cs
- DomainConstraint.cs
- MenuAdapter.cs
- CallbackValidatorAttribute.cs
- ValueExpressions.cs
- IsolatedStorageFile.cs
- ByteStreamMessageEncodingElement.cs
- RNGCryptoServiceProvider.cs
- TimelineGroup.cs
- BasicHttpBinding.cs
- ArrayList.cs
- PassportAuthenticationModule.cs
- DoubleAnimationBase.cs
- ConnectionStringSettings.cs
- UriTemplateDispatchFormatter.cs
- BaseConfigurationRecord.cs
- SecureConversationSecurityTokenParameters.cs
- ActivityUtilities.cs
- SchemaEntity.cs
- DataComponentGenerator.cs
- RadioButton.cs
- DesignerValidationSummaryAdapter.cs
- ClientData.cs
- PropertyToken.cs
- EUCJPEncoding.cs
- PermissionSetTriple.cs
- MachineSettingsSection.cs
- SplitterCancelEvent.cs
- DocumentPage.cs
- ChangeNode.cs
- FlowLayoutSettings.cs
- DynamicDocumentPaginator.cs
- ComponentCollection.cs
- Vertex.cs
- QueryException.cs
- TypeAccessException.cs
- PropertyMetadata.cs
- ResetableIterator.cs
- MatrixAnimationUsingPath.cs
- ValueUtilsSmi.cs
- DecoderReplacementFallback.cs
- Bezier.cs
- ColumnCollection.cs
- SmiConnection.cs
- ImageField.cs
- QueryComponents.cs
- DataGridRow.cs
- OleDbError.cs
- HandlerWithFactory.cs
- ButtonBase.cs
- EventSourceCreationData.cs
- GlyphRunDrawing.cs
- ResolveDuplex11AsyncResult.cs
- PartialCachingControl.cs
- SystemKeyConverter.cs
- Rect3DValueSerializer.cs
- SafeUserTokenHandle.cs
- MustUnderstandBehavior.cs
- Delegate.cs
- TraceHandler.cs
- ProtocolReflector.cs
- ObjectDisposedException.cs
- CryptoProvider.cs
- DirectoryObjectSecurity.cs
- DesignerAutoFormatCollection.cs
- DbTransaction.cs
- EncryptedKeyIdentifierClause.cs
- CreateInstanceBinder.cs
- securitycriticaldataClass.cs
- OutputScopeManager.cs
- CachedTypeface.cs
- WindowsPen.cs
- OutputBuffer.cs
- ToolStripDropTargetManager.cs
- LineServicesCallbacks.cs
- ConstructorNeedsTagAttribute.cs
- contentDescriptor.cs
- HtmlEmptyTagControlBuilder.cs
- XmlReaderSettings.cs
- DataGridViewCellValidatingEventArgs.cs
- SeekableReadStream.cs
- RectConverter.cs
- PerspectiveCamera.cs