Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / HttpListenerPrefixCollection.cs / 1 / HttpListenerPrefixCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net { using System; using System.Collections; using System.Collections.Generic; internal class ListenerPrefixEnumerator:IEnumerator{ IEnumerator enumerator; internal ListenerPrefixEnumerator(IEnumerator enumerator){ this.enumerator = enumerator; } public string Current{ get{ return (string)enumerator.Current; } } public bool MoveNext(){ return enumerator.MoveNext(); } public void Dispose(){ } void System.Collections.IEnumerator.Reset(){ enumerator.Reset(); } object System.Collections.IEnumerator.Current{ get{ return enumerator.Current; } } } public class HttpListenerPrefixCollection : ICollection { private HttpListener m_HttpListener; internal HttpListenerPrefixCollection(HttpListener listener) { m_HttpListener = listener; } public void CopyTo(Array array, int offset) { m_HttpListener.CheckDisposed(); if (Count>array.Length) { throw new ArgumentOutOfRangeException("array", SR.GetString(SR.net_array_too_small)); } if (offset+Count>array.Length) { throw new ArgumentOutOfRangeException("offset"); } int index = 0; foreach (string uriPrefix in m_HttpListener.m_UriPrefixes.Keys) { array.SetValue(uriPrefix, offset + index++); } } public void CopyTo(string[] array, int offset) { m_HttpListener.CheckDisposed(); if (Count>array.Length) { throw new ArgumentOutOfRangeException("array", SR.GetString(SR.net_array_too_small)); } if (offset+Count>array.Length) { throw new ArgumentOutOfRangeException("offset"); } int index = 0; foreach (string uriPrefix in m_HttpListener.m_UriPrefixes.Keys) { array[offset + index++] = uriPrefix; } } public int Count { get { return m_HttpListener.m_UriPrefixes.Count; } } public bool IsSynchronized { get { return false; } } public bool IsReadOnly { get { return false; } } public void Add(string uriPrefix) { m_HttpListener.AddPrefix(uriPrefix); } public bool Contains(string uriPrefix) { return m_HttpListener.m_UriPrefixes.Contains(uriPrefix); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return null; } public IEnumerator GetEnumerator() { return new ListenerPrefixEnumerator(m_HttpListener.m_UriPrefixes.Keys.GetEnumerator()); } public bool Remove(string uriPrefix) { return m_HttpListener.RemovePrefix(uriPrefix); } public void Clear() { m_HttpListener.RemoveAll(true); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HuffmanTree.cs
- InplaceBitmapMetadataWriter.cs
- FrugalList.cs
- HitTestWithPointDrawingContextWalker.cs
- UnsafeNativeMethods.cs
- StylusButtonCollection.cs
- Helpers.cs
- InteropBitmapSource.cs
- odbcmetadatacollectionnames.cs
- ProviderConnectionPointCollection.cs
- BitmapEffectDrawingContent.cs
- WebPartDeleteVerb.cs
- HMACSHA384.cs
- Compiler.cs
- WmlCalendarAdapter.cs
- TCPListener.cs
- XmlnsPrefixAttribute.cs
- LinearGradientBrush.cs
- ClosableStream.cs
- DrawingCollection.cs
- CultureTableRecord.cs
- SqlInternalConnectionTds.cs
- ISAPIApplicationHost.cs
- SerializationFieldInfo.cs
- HwndSourceParameters.cs
- Debug.cs
- AxHost.cs
- shaperfactoryquerycachekey.cs
- ComplexObject.cs
- WebPartUserCapability.cs
- AnchoredBlock.cs
- ControlFilterExpression.cs
- ProgressBarBrushConverter.cs
- MinMaxParagraphWidth.cs
- Funcletizer.cs
- RoamingStoreFileUtility.cs
- EntityCodeGenerator.cs
- DataGridRowHeaderAutomationPeer.cs
- ByteFacetDescriptionElement.cs
- MonitorWrapper.cs
- DrawingImage.cs
- UnionExpr.cs
- TcpServerChannel.cs
- TypeUsageBuilder.cs
- DataGridViewComboBoxColumn.cs
- SqlDataRecord.cs
- CrossSiteScriptingValidation.cs
- ManagementObjectCollection.cs
- FontSource.cs
- DetailsViewUpdateEventArgs.cs
- StylusLogic.cs
- SolidBrush.cs
- CommandArguments.cs
- ScrollProviderWrapper.cs
- LinkedResourceCollection.cs
- AssociatedControlConverter.cs
- CounterCreationDataConverter.cs
- CellRelation.cs
- CustomAttribute.cs
- TextBoxLine.cs
- HttpValueCollection.cs
- TemplateManager.cs
- InputProcessorProfilesLoader.cs
- Util.cs
- NativeMethods.cs
- DES.cs
- DbMetaDataFactory.cs
- CompiledQuery.cs
- SettingsBindableAttribute.cs
- DataRowExtensions.cs
- TrustManagerMoreInformation.cs
- EntityProxyTypeInfo.cs
- HtmlInputButton.cs
- Options.cs
- WebPartTransformerCollection.cs
- OdbcDataAdapter.cs
- WebMessageEncodingElement.cs
- AuthenticationManager.cs
- MergeExecutor.cs
- BaseAsyncResult.cs
- FrameworkElement.cs
- Soap12ProtocolReflector.cs
- HtmlButton.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- CryptoConfig.cs
- VisualStyleElement.cs
- XhtmlBasicListAdapter.cs
- InstanceLockTracking.cs
- ExpandedWrapper.cs
- FontWeights.cs
- TransactedReceiveScope.cs
- TraceListener.cs
- ConfigXmlWhitespace.cs
- TableLayoutColumnStyleCollection.cs
- RectangleGeometry.cs
- FontUnit.cs
- CounterSet.cs
- XmlReflectionImporter.cs
- XappLauncher.cs
- ImportedNamespaceContextItem.cs