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
- StringKeyFrameCollection.cs
- PartitionerQueryOperator.cs
- RadioButton.cs
- SizeLimitedCache.cs
- ExpressionEvaluator.cs
- MetadataItemSerializer.cs
- BaseResourcesBuildProvider.cs
- UpdatePanelTrigger.cs
- SourceChangedEventArgs.cs
- ToolStripControlHost.cs
- AutoCompleteStringCollection.cs
- DataSourceProvider.cs
- BinaryObjectInfo.cs
- SaveCardRequest.cs
- FontUnitConverter.cs
- CommonDialog.cs
- OverlappedAsyncResult.cs
- ColorContext.cs
- FrameworkElementFactory.cs
- TileModeValidation.cs
- CodeDirectionExpression.cs
- DataGridTextBoxColumn.cs
- ImageDrawing.cs
- ZoneMembershipCondition.cs
- DataGridTableCollection.cs
- ReflectionTypeLoadException.cs
- DependencyPropertyConverter.cs
- DataGridViewCellCollection.cs
- TypeToken.cs
- PlanCompiler.cs
- KnownBoxes.cs
- serverconfig.cs
- TextFindEngine.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- EmbeddedMailObject.cs
- DynamicArgumentDesigner.xaml.cs
- PrimitiveXmlSerializers.cs
- HtmlInputImage.cs
- DesignerActionService.cs
- TemplateBamlTreeBuilder.cs
- CalendarItem.cs
- FactoryId.cs
- EffectiveValueEntry.cs
- ReadOnlyCollection.cs
- DataControlButton.cs
- Rules.cs
- ToolStripItemEventArgs.cs
- XsltOutput.cs
- RichTextBox.cs
- TypefaceMap.cs
- Panel.cs
- UrlPropertyAttribute.cs
- NullReferenceException.cs
- CodeIterationStatement.cs
- HostElement.cs
- DriveNotFoundException.cs
- SqlBuffer.cs
- TableRow.cs
- LinkLabel.cs
- TextHidden.cs
- XmlTypeAttribute.cs
- TextMarkerSource.cs
- mongolianshape.cs
- HexParser.cs
- milrender.cs
- OutputScope.cs
- SessionStateSection.cs
- ConnectionConsumerAttribute.cs
- RepeatButtonAutomationPeer.cs
- SoapAttributes.cs
- ColumnResizeUndoUnit.cs
- ItemList.cs
- x509utils.cs
- PartialCachingAttribute.cs
- StatusBarDrawItemEvent.cs
- HtmlFormParameterReader.cs
- diagnosticsswitches.cs
- DesignerToolStripControlHost.cs
- Root.cs
- sqlcontext.cs
- PointHitTestParameters.cs
- Identity.cs
- Help.cs
- WebPartMovingEventArgs.cs
- FunctionDescription.cs
- GuidelineCollection.cs
- _ChunkParse.cs
- StrongName.cs
- WorkflowTerminatedException.cs
- SecureEnvironment.cs
- ToolStripDropTargetManager.cs
- StrokeSerializer.cs
- FileDataSourceCache.cs
- PerformanceCounterPermissionEntry.cs
- AlternateViewCollection.cs
- SafeReversePInvokeHandle.cs
- SettingsBase.cs
- DbConnectionPoolGroupProviderInfo.cs
- ResourceDictionary.cs
- SoapCommonClasses.cs