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
- UrlEncodedParameterWriter.cs
- ClickablePoint.cs
- PreProcessor.cs
- ToolTip.cs
- ListDictionary.cs
- CustomCredentialPolicy.cs
- BamlResourceContent.cs
- ValuePattern.cs
- SerialErrors.cs
- PerSessionInstanceContextProvider.cs
- _ListenerRequestStream.cs
- ClientOptions.cs
- HandoffBehavior.cs
- ProtocolsConfigurationEntry.cs
- OpCopier.cs
- ScriptHandlerFactory.cs
- TextRunCache.cs
- RoutedUICommand.cs
- DictionaryEntry.cs
- NegotiateStream.cs
- SafeNativeMethods.cs
- RegexWorker.cs
- HttpClientProtocol.cs
- dtdvalidator.cs
- AppDomainManager.cs
- StylusPointDescription.cs
- RunInstallerAttribute.cs
- QuaternionAnimation.cs
- ConnectionStringsSection.cs
- RectangleF.cs
- Shape.cs
- UpDownBase.cs
- SeparatorAutomationPeer.cs
- TreeViewItemAutomationPeer.cs
- ToolStripScrollButton.cs
- X509CertificateCollection.cs
- IdleTimeoutMonitor.cs
- TableLayoutStyleCollection.cs
- TypeConverterHelper.cs
- Double.cs
- OptimizedTemplateContentHelper.cs
- ConnectionPoolManager.cs
- RectValueSerializer.cs
- COMException.cs
- TypefaceMap.cs
- Keyboard.cs
- ValidationSummary.cs
- Queue.cs
- TrustExchangeException.cs
- MobileUserControl.cs
- CacheMemory.cs
- XmlDocument.cs
- Slider.cs
- StaticExtension.cs
- TableLayout.cs
- InputLanguage.cs
- SmiRequestExecutor.cs
- BitmapEffectrendercontext.cs
- TreePrinter.cs
- ParallelActivityDesigner.cs
- OraclePermissionAttribute.cs
- CultureMapper.cs
- SqlVisitor.cs
- HttpRequestTraceRecord.cs
- WebPageTraceListener.cs
- BaseDataList.cs
- ImageListStreamer.cs
- DictionaryBase.cs
- TypeUtils.cs
- ActivityXRefConverter.cs
- HttpCapabilitiesSectionHandler.cs
- ResourceAssociationSetEnd.cs
- DisplayClaim.cs
- ClientScriptManager.cs
- CompilationPass2TaskInternal.cs
- HttpRequestWrapper.cs
- WindowPatternIdentifiers.cs
- BitmapSourceSafeMILHandle.cs
- BuildManagerHost.cs
- CancelRequestedRecord.cs
- SlipBehavior.cs
- GeometryDrawing.cs
- DispatcherHooks.cs
- PenContext.cs
- ListViewGroupConverter.cs
- Util.cs
- DoubleStorage.cs
- BreakSafeBase.cs
- DesignerForm.cs
- Queue.cs
- UriSchemeKeyedCollection.cs
- RectangleHotSpot.cs
- WindowsNonControl.cs
- TimeoutValidationAttribute.cs
- DispatcherEventArgs.cs
- ReadOnlyDictionary.cs
- XmlUrlResolver.cs
- BooleanExpr.cs
- DllNotFoundException.cs
- DataBinder.cs