143 lines
6.3 KiB
C#
143 lines
6.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
namespace System.Net.NetworkInformation
|
|
{
|
|
/// <summary>Stores a set of <see cref="T:System.Net.IPAddress" /> types.</summary>
|
|
// Token: 0x0200015C RID: 348
|
|
public class IPAddressCollection : IEnumerable, ICollection<IPAddress>, IEnumerable<IPAddress>
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.NetworkInformation.IPAddressCollection" /> class.</summary>
|
|
// Token: 0x06000BB1 RID: 2993 RVA: 0x00023DFC File Offset: 0x00021FFC
|
|
protected internal IPAddressCollection()
|
|
{
|
|
}
|
|
|
|
/// <summary>Returns an object that can be used to iterate through this collection.</summary>
|
|
/// <returns>An object that implements the <see cref="T:System.Collections.IEnumerator" /> interface and provides access to the <see cref="T:System.Net.NetworkInformation.IPAddressCollection" /> types in this collection.</returns>
|
|
// Token: 0x06000BB2 RID: 2994 RVA: 0x00023E10 File Offset: 0x00022010
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return this.list.GetEnumerator();
|
|
}
|
|
|
|
// Token: 0x06000BB3 RID: 2995 RVA: 0x00023E20 File Offset: 0x00022020
|
|
internal void SetReadOnly()
|
|
{
|
|
if (!this.IsReadOnly)
|
|
{
|
|
this.list = ((List<IPAddress>)this.list).AsReadOnly();
|
|
}
|
|
}
|
|
|
|
/// <summary>Throws a <see cref="T:System.NotSupportedException" /> because this operation is not supported for this collection.</summary>
|
|
/// <param name="address">The object to be added to the collection.</param>
|
|
// Token: 0x06000BB4 RID: 2996 RVA: 0x00023E44 File Offset: 0x00022044
|
|
public virtual void Add(IPAddress address)
|
|
{
|
|
if (this.IsReadOnly)
|
|
{
|
|
throw new NotSupportedException("The collection is read-only.");
|
|
}
|
|
this.list.Add(address);
|
|
}
|
|
|
|
/// <summary>Throws a <see cref="T:System.NotSupportedException" /> because this operation is not supported for this collection.</summary>
|
|
// Token: 0x06000BB5 RID: 2997 RVA: 0x00023E74 File Offset: 0x00022074
|
|
public virtual void Clear()
|
|
{
|
|
if (this.IsReadOnly)
|
|
{
|
|
throw new NotSupportedException("The collection is read-only.");
|
|
}
|
|
this.list.Clear();
|
|
}
|
|
|
|
/// <summary>Checks whether the collection contains the specified <see cref="T:System.Net.IPAddress" /> object.</summary>
|
|
/// <returns>true if the <see cref="T:System.Net.IPAddress" /> object exists in the collection; otherwise, false.</returns>
|
|
/// <param name="address">The <see cref="T:System.Net.IPAddress" /> object to be searched in the collection.</param>
|
|
// Token: 0x06000BB6 RID: 2998 RVA: 0x00023E98 File Offset: 0x00022098
|
|
public virtual bool Contains(IPAddress address)
|
|
{
|
|
return this.list.Contains(address);
|
|
}
|
|
|
|
/// <summary>Copies the elements in this collection to a one-dimensional array of type <see cref="T:System.Net.IPAddress" />.</summary>
|
|
/// <param name="array">A one-dimensional array that receives a copy of the collection.</param>
|
|
/// <param name="offset">The zero-based index in <paramref name="array" /> at which the copy begins.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="array" /> is null. </exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="offset" /> is less than zero. </exception>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="array" /> is multidimensional.-or-The number of elements in this <see cref="T:System.Net.NetworkInformation.IPAddressCollection" /> is greater than the available space from <paramref name="offset" /> to the end of the destination <paramref name="array" />. </exception>
|
|
/// <exception cref="T:System.InvalidCastException">The elements in this <see cref="T:System.Net.NetworkInformation.IPAddressCollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />. </exception>
|
|
// Token: 0x06000BB7 RID: 2999 RVA: 0x00023EA8 File Offset: 0x000220A8
|
|
public virtual void CopyTo(IPAddress[] array, int offset)
|
|
{
|
|
this.list.CopyTo(array, offset);
|
|
}
|
|
|
|
/// <summary>Returns an object that can be used to iterate through this collection.</summary>
|
|
/// <returns>An object that implements the <see cref="T:System.Collections.IEnumerator" /> interface and provides access to the <see cref="T:System.Net.NetworkInformation.IPAddressCollection" /> types in this collection.</returns>
|
|
// Token: 0x06000BB8 RID: 3000 RVA: 0x00023EB8 File Offset: 0x000220B8
|
|
public virtual IEnumerator<IPAddress> GetEnumerator()
|
|
{
|
|
return this.list.GetEnumerator();
|
|
}
|
|
|
|
/// <summary>Throws a <see cref="T:System.NotSupportedException" /> because this operation is not supported for this collection.</summary>
|
|
/// <returns>Always throws a <see cref="T:System.NotSupportedException" />.</returns>
|
|
/// <param name="address">The object to be removed.</param>
|
|
// Token: 0x06000BB9 RID: 3001 RVA: 0x00023EC8 File Offset: 0x000220C8
|
|
public virtual bool Remove(IPAddress address)
|
|
{
|
|
if (this.IsReadOnly)
|
|
{
|
|
throw new NotSupportedException("The collection is read-only.");
|
|
}
|
|
return this.list.Remove(address);
|
|
}
|
|
|
|
/// <summary>Gets the number of <see cref="T:System.Net.IPAddress" /> types in this collection.</summary>
|
|
/// <returns>An <see cref="T:System.Int32" /> value that contains the number of <see cref="T:System.Net.IPAddress" /> types in this collection.</returns>
|
|
// Token: 0x170002F0 RID: 752
|
|
// (get) Token: 0x06000BBA RID: 3002 RVA: 0x00023EF8 File Offset: 0x000220F8
|
|
public virtual int Count
|
|
{
|
|
get
|
|
{
|
|
return this.list.Count;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value that indicates whether access to this collection is read-only.</summary>
|
|
/// <returns>true in all cases.</returns>
|
|
// Token: 0x170002F1 RID: 753
|
|
// (get) Token: 0x06000BBB RID: 3003 RVA: 0x00023F08 File Offset: 0x00022108
|
|
public virtual bool IsReadOnly
|
|
{
|
|
get
|
|
{
|
|
return this.list.IsReadOnly;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the <see cref="T:System.Net.IPAddress" /> at the specific index of the collection.</summary>
|
|
/// <returns>The <see cref="T:System.Net.IPAddress" /> at the specific index in the collection.</returns>
|
|
/// <param name="index">The index of interest.</param>
|
|
// Token: 0x170002F2 RID: 754
|
|
public virtual IPAddress this[int index]
|
|
{
|
|
get
|
|
{
|
|
return this.list[index];
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000B9D RID: 2973
|
|
private IList<IPAddress> list = new List<IPAddress>();
|
|
}
|
|
}
|