Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Configuration / IdnElement.cs / 2 / IdnElement.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Configuration
{
using System;
using System.Reflection;
using System.ComponentModel;
using System.Globalization;
public sealed class IdnElement : ConfigurationElement
{
public IdnElement()
{
this.properties.Add(this.enabled);
}
protected override ConfigurationPropertyCollection Properties
{
get{
return this.properties;
}
}
[ConfigurationProperty(CommonConfigurationStrings.Enabled, DefaultValue = (UriIdnScope)UriIdnScope.None)]
public UriIdnScope Enabled
{
get { return (UriIdnScope)this[this.enabled]; }
set { this[this.enabled] = value; }
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty enabled =
new ConfigurationProperty(CommonConfigurationStrings.Enabled, typeof(UriIdnScope), UriIdnScope.None, new UriIdnScopeTypeConverter(), null,
ConfigurationPropertyOptions.None);
class UriIdnScopeTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(string)){
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
string s = value as string;
if (s != null){
s = s.ToLower(CultureInfo.InvariantCulture);
switch (s){
case "all":
return UriIdnScope.All;
case "none":
return UriIdnScope.None;
case "allexceptintranet":
return UriIdnScope.AllExceptIntranet;
}
}
return base.ConvertFrom(context, culture, value);
}
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BuilderInfo.cs
- TemplateBindingExpression.cs
- ToolStripManager.cs
- _ConnectStream.cs
- Pair.cs
- FloatUtil.cs
- Fx.cs
- ExtenderHelpers.cs
- RemotingAttributes.cs
- DetailsViewInsertEventArgs.cs
- TdsParserSessionPool.cs
- DBSqlParserTable.cs
- MatrixAnimationBase.cs
- MouseGesture.cs
- SimpleTypesSurrogate.cs
- SystemIcons.cs
- ColorContext.cs
- DoubleAnimationBase.cs
- DirectionalLight.cs
- FileDialog_Vista.cs
- FilePrompt.cs
- EasingFunctionBase.cs
- IisTraceListener.cs
- ArglessEventHandlerProxy.cs
- WasEndpointConfigContainer.cs
- GPPOINTF.cs
- XmlNamespaceMapping.cs
- EntityDataSourceDesigner.cs
- SwitchElementsCollection.cs
- RegistrySecurity.cs
- Application.cs
- EditorZoneBase.cs
- RegexWorker.cs
- CharacterBuffer.cs
- UrlMappingsSection.cs
- PseudoWebRequest.cs
- GeometryCombineModeValidation.cs
- Argument.cs
- ServiceModelActivity.cs
- UserThread.cs
- SqlParameterCollection.cs
- EntityViewGenerationAttribute.cs
- RichTextBox.cs
- JsonEnumDataContract.cs
- KeyGesture.cs
- NotifyIcon.cs
- AuthenticationSchemesHelper.cs
- SqlVersion.cs
- XpsS0ValidatingLoader.cs
- TextRangeEditLists.cs
- CheckBox.cs
- DbConnectionOptions.cs
- coordinatorfactory.cs
- Int32RectConverter.cs
- Line.cs
- COSERVERINFO.cs
- CodeGeneratorAttribute.cs
- TypeLoadException.cs
- Condition.cs
- AddInPipelineAttributes.cs
- DescendentsWalkerBase.cs
- HtmlInputPassword.cs
- SqlVersion.cs
- ImageField.cs
- webeventbuffer.cs
- XmlKeywords.cs
- HttpModulesSection.cs
- EventEntry.cs
- MobileErrorInfo.cs
- RelatedView.cs
- SqlCharStream.cs
- SimpleMailWebEventProvider.cs
- wmiprovider.cs
- LabelDesigner.cs
- SoundPlayer.cs
- GeometryHitTestResult.cs
- ToggleButtonAutomationPeer.cs
- EmptyTextWriter.cs
- DesignerLabelAdapter.cs
- ProfileBuildProvider.cs
- __ConsoleStream.cs
- ReflectionTypeLoadException.cs
- HMACMD5.cs
- TextPatternIdentifiers.cs
- MaterialGroup.cs
- JsonSerializer.cs
- XPathNavigator.cs
- IncrementalHitTester.cs
- MouseGestureValueSerializer.cs
- MDIClient.cs
- DivideByZeroException.cs
- BaseHashHelper.cs
- EllipseGeometry.cs
- DBConnectionString.cs
- ThicknessAnimation.cs
- ArgIterator.cs
- UserMapPath.cs
- CollectionChangedEventManager.cs
- MyContact.cs
- SqlUDTStorage.cs