Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- PreProcessInputEventArgs.cs
- ScalarType.cs
- TextEditorCopyPaste.cs
- StrongName.cs
- XmlNullResolver.cs
- NamespaceMapping.cs
- RuleConditionDialog.Designer.cs
- DivideByZeroException.cs
- TabletDevice.cs
- TdsValueSetter.cs
- EventlogProvider.cs
- ComponentCollection.cs
- ObjectManager.cs
- RepeatBehaviorConverter.cs
- TransformValueSerializer.cs
- HostExecutionContextManager.cs
- CodeConstructor.cs
- OdbcRowUpdatingEvent.cs
- listitem.cs
- WindowsFormsHostPropertyMap.cs
- SafeSystemMetrics.cs
- PasswordBoxAutomationPeer.cs
- AssemblyInfo.cs
- DataGridViewTopRowAccessibleObject.cs
- FlowLayoutPanel.cs
- translator.cs
- Int32.cs
- mediaeventargs.cs
- ZipArchive.cs
- IndexedEnumerable.cs
- DateTimeStorage.cs
- TransformerInfo.cs
- SqlDataSourceQueryEditor.cs
- OperationPickerDialog.designer.cs
- StrokeCollection.cs
- DiagnosticSection.cs
- PropertyInformationCollection.cs
- WaitHandle.cs
- SqlDataSourceWizardForm.cs
- UrlMappingsModule.cs
- AuthorizationSection.cs
- CodeCompileUnit.cs
- ClientScriptItem.cs
- ScriptServiceAttribute.cs
- DataGridColumnHeaderAutomationPeer.cs
- EditorBrowsableAttribute.cs
- XmlUTF8TextReader.cs
- IListConverters.cs
- SelectionPattern.cs
- ServiceThrottlingElement.cs
- NumberFunctions.cs
- TextStore.cs
- TypeUtil.cs
- UnmanagedMemoryStream.cs
- MachineKeySection.cs
- InputBindingCollection.cs
- WmlCalendarAdapter.cs
- AutomationElementCollection.cs
- SerializationHelper.cs
- SingleResultAttribute.cs
- CfgSemanticTag.cs
- ObjectDataSourceFilteringEventArgs.cs
- UniqueConstraint.cs
- GridViewCommandEventArgs.cs
- GlobalAllocSafeHandle.cs
- CapabilitiesRule.cs
- PtsHelper.cs
- ResourceDisplayNameAttribute.cs
- ToolStripRendererSwitcher.cs
- EntityDesignerDataSourceView.cs
- RoleManagerEventArgs.cs
- CfgArc.cs
- AssemblyAssociatedContentFileAttribute.cs
- Emitter.cs
- ITreeGenerator.cs
- KnownTypes.cs
- DefaultBindingPropertyAttribute.cs
- AttachInfo.cs
- BlurBitmapEffect.cs
- WeakEventManager.cs
- CheckBox.cs
- AuthenticationSection.cs
- AlphabeticalEnumConverter.cs
- ScriptComponentDescriptor.cs
- XD.cs
- WebPartUtil.cs
- InputLanguageSource.cs
- KeyedHashAlgorithm.cs
- MethodImplAttribute.cs
- WebServicesDescriptionAttribute.cs
- XmlAtomicValue.cs
- itemelement.cs
- SqlServer2KCompatibilityAnnotation.cs
- XmlSchemaInclude.cs
- PenLineJoinValidation.cs
- TimeoutConverter.cs
- RootProfilePropertySettingsCollection.cs
- TraceLog.cs
- BatchServiceHost.cs
- Schema.cs