Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Net / System / Net / Configuration / SocketElement.cs / 1 / SocketElement.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Net.Configuration
{
using System;
using System.Configuration;
using System.Reflection;
using System.Security.Permissions;
public sealed class SocketElement : ConfigurationElement
{
public SocketElement()
{
this.properties.Add(this.alwaysUseCompletionPortsForAccept);
this.properties.Add(this.alwaysUseCompletionPortsForConnect);
}
protected override void PostDeserialize()
{
// Perf optimization. If the configuration is coming from machine.config
// It is safe and we don't need to check for permissions.
if (EvaluationContext.IsMachineLevel)
return;
try {
ExceptionHelper.UnrestrictedSocketPermission.Demand();
} catch (Exception exception) {
throw new ConfigurationErrorsException(
SR.GetString(SR.net_config_element_permission,
ConfigurationStrings.Socket),
exception);
}
}
[ConfigurationProperty(ConfigurationStrings.AlwaysUseCompletionPortsForAccept, DefaultValue = false)]
public bool AlwaysUseCompletionPortsForAccept
{
get { return (bool)this[this.alwaysUseCompletionPortsForAccept]; }
set { this[this.alwaysUseCompletionPortsForAccept] = value; }
}
[ConfigurationProperty(ConfigurationStrings.AlwaysUseCompletionPortsForConnect, DefaultValue = false)]
public bool AlwaysUseCompletionPortsForConnect
{
get { return (bool)this[this.alwaysUseCompletionPortsForConnect]; }
set { this[this.alwaysUseCompletionPortsForConnect] = value; }
}
protected override ConfigurationPropertyCollection Properties
{
get
{
return this.properties;
}
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty alwaysUseCompletionPortsForConnect =
new ConfigurationProperty(ConfigurationStrings.AlwaysUseCompletionPortsForConnect, typeof(bool), false,
ConfigurationPropertyOptions.None);
readonly ConfigurationProperty alwaysUseCompletionPortsForAccept =
new ConfigurationProperty(ConfigurationStrings.AlwaysUseCompletionPortsForAccept, typeof(bool), false,
ConfigurationPropertyOptions.None);
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Net.Configuration
{
using System;
using System.Configuration;
using System.Reflection;
using System.Security.Permissions;
public sealed class SocketElement : ConfigurationElement
{
public SocketElement()
{
this.properties.Add(this.alwaysUseCompletionPortsForAccept);
this.properties.Add(this.alwaysUseCompletionPortsForConnect);
}
protected override void PostDeserialize()
{
// Perf optimization. If the configuration is coming from machine.config
// It is safe and we don't need to check for permissions.
if (EvaluationContext.IsMachineLevel)
return;
try {
ExceptionHelper.UnrestrictedSocketPermission.Demand();
} catch (Exception exception) {
throw new ConfigurationErrorsException(
SR.GetString(SR.net_config_element_permission,
ConfigurationStrings.Socket),
exception);
}
}
[ConfigurationProperty(ConfigurationStrings.AlwaysUseCompletionPortsForAccept, DefaultValue = false)]
public bool AlwaysUseCompletionPortsForAccept
{
get { return (bool)this[this.alwaysUseCompletionPortsForAccept]; }
set { this[this.alwaysUseCompletionPortsForAccept] = value; }
}
[ConfigurationProperty(ConfigurationStrings.AlwaysUseCompletionPortsForConnect, DefaultValue = false)]
public bool AlwaysUseCompletionPortsForConnect
{
get { return (bool)this[this.alwaysUseCompletionPortsForConnect]; }
set { this[this.alwaysUseCompletionPortsForConnect] = value; }
}
protected override ConfigurationPropertyCollection Properties
{
get
{
return this.properties;
}
}
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
readonly ConfigurationProperty alwaysUseCompletionPortsForConnect =
new ConfigurationProperty(ConfigurationStrings.AlwaysUseCompletionPortsForConnect, typeof(bool), false,
ConfigurationPropertyOptions.None);
readonly ConfigurationProperty alwaysUseCompletionPortsForAccept =
new ConfigurationProperty(ConfigurationStrings.AlwaysUseCompletionPortsForAccept, typeof(bool), false,
ConfigurationPropertyOptions.None);
}
}
// 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
- AnchoredBlock.cs
- basemetadatamappingvisitor.cs
- IncrementalReadDecoders.cs
- MethodBody.cs
- RuntimeVariablesExpression.cs
- Nullable.cs
- DataGridViewColumn.cs
- CacheOutputQuery.cs
- VariableValue.cs
- ObjectKeyFrameCollection.cs
- SetterBase.cs
- Menu.cs
- CaseCqlBlock.cs
- HttpContextServiceHost.cs
- SqlCharStream.cs
- XmlSchemaAttributeGroup.cs
- XPathScanner.cs
- CommandConverter.cs
- SspiSecurityTokenProvider.cs
- QualifiedId.cs
- StorageConditionPropertyMapping.cs
- Help.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- XmlDocument.cs
- ListControl.cs
- ValueUtilsSmi.cs
- TimerEventSubscription.cs
- Control.cs
- ProcessThreadCollection.cs
- TypeToken.cs
- RSAOAEPKeyExchangeDeformatter.cs
- ProfileSettingsCollection.cs
- ImageCodecInfo.cs
- DataGridRow.cs
- BookmarkUndoUnit.cs
- ToolStripSeparator.cs
- RandomNumberGenerator.cs
- InternalMappingException.cs
- BuilderPropertyEntry.cs
- PageSettings.cs
- XmlSerializerNamespaces.cs
- PropertyChangingEventArgs.cs
- LineServices.cs
- PopupEventArgs.cs
- WebHeaderCollection.cs
- SocketElement.cs
- CompositionDesigner.cs
- connectionpool.cs
- DesignerVerbCollection.cs
- UnionCqlBlock.cs
- EventLogPermissionAttribute.cs
- MatrixCamera.cs
- ReadOnlyAttribute.cs
- WorkflowTimerService.cs
- SizeLimitedCache.cs
- ObjectSecurity.cs
- ModuleConfigurationInfo.cs
- DataGridViewCellFormattingEventArgs.cs
- ExportOptions.cs
- RangeBase.cs
- CheckBoxAutomationPeer.cs
- SuppressMergeCheckAttribute.cs
- DataGridTable.cs
- SqlWebEventProvider.cs
- GeometryDrawing.cs
- OperationAbortedException.cs
- ComponentSerializationService.cs
- AccessViolationException.cs
- EncryptedData.cs
- AtomParser.cs
- XmlQueryRuntime.cs
- StringValueSerializer.cs
- EntityDataSourceStatementEditorForm.cs
- ConnectionConsumerAttribute.cs
- InputScopeNameConverter.cs
- ToolZone.cs
- RoutedUICommand.cs
- DBConnection.cs
- HotSpot.cs
- ListenDesigner.cs
- HandlerFactoryWrapper.cs
- StrongNameMembershipCondition.cs
- PrintDialogDesigner.cs
- DiscoveryMessageProperty.cs
- URLMembershipCondition.cs
- SegmentInfo.cs
- GenericArgumentsUpdater.cs
- TreeNodeStyle.cs
- TextTreeInsertUndoUnit.cs
- SystemIPv6InterfaceProperties.cs
- GreenMethods.cs
- KnownBoxes.cs
- SmiEventSink_Default.cs
- DefaultValueTypeConverter.cs
- ArgumentOutOfRangeException.cs
- XmlDictionaryString.cs
- FamilyMapCollection.cs
- ViewSimplifier.cs
- EntryIndex.cs
- OLEDB_Util.cs