Clean
This commit is contained in:
@@ -27,26 +27,26 @@ using System.Collections;
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Da
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of items.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCDaItemCollection : ICloneable, IList
|
||||
{
|
||||
#region Fields
|
||||
/// <summary>
|
||||
/// A collection of items.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCDaItemCollection : ICloneable, IList
|
||||
{
|
||||
#region Fields
|
||||
private ArrayList items_ = new ArrayList();
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCDaItemCollection() { }
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCDaItemCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ResultCollection object.
|
||||
/// </summary>
|
||||
public TsCDaItemCollection(TsCDaItemCollection items)
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ResultCollection object.
|
||||
/// </summary>
|
||||
public TsCDaItemCollection(TsCDaItemCollection items)
|
||||
{
|
||||
if (items == null)
|
||||
{
|
||||
@@ -59,59 +59,59 @@ namespace Technosoftware.DaAeHdaClient.Da
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Gets the item at the specified index.
|
||||
/// </summary>
|
||||
public TsCDaItem this[int index]
|
||||
{
|
||||
get => (TsCDaItem)items_[index];
|
||||
/// Gets the item at the specified index.
|
||||
/// </summary>
|
||||
public TsCDaItem this[int index]
|
||||
{
|
||||
get => (TsCDaItem)items_[index];
|
||||
set => items_[index] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the first item with the specified item id.
|
||||
/// </summary>
|
||||
public TsCDaItem this[OpcItem itemId]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (TsCDaItem item in items_)
|
||||
{
|
||||
if (itemId.Key == item.Key)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the first item with the specified item id.
|
||||
/// </summary>
|
||||
public TsCDaItem this[OpcItem itemId]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (TsCDaItem item in items_)
|
||||
{
|
||||
if (itemId.Key == item.Key)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
var clone = (TsCDaItemCollection)MemberwiseClone();
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
var clone = (TsCDaItemCollection)MemberwiseClone();
|
||||
|
||||
clone.items_ = new ArrayList();
|
||||
clone.items_ = new ArrayList();
|
||||
|
||||
foreach (TsCDaItem item in items_)
|
||||
{
|
||||
clone.items_.Add(item.Clone());
|
||||
}
|
||||
foreach (TsCDaItem item in items_)
|
||||
{
|
||||
clone.items_.Add(item.Clone());
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
@@ -128,137 +128,137 @@ namespace Technosoftware.DaAeHdaClient.Da
|
||||
items_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCDaItem[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCDaItem[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return items_.GetEnumerator();
|
||||
}
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return items_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => items_[index];
|
||||
{
|
||||
get => items_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!typeof(TsCDaItem).IsInstanceOfType(value))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
{
|
||||
if (!typeof(TsCDaItem).IsInstanceOfType(value))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
|
||||
items_[index] = value;
|
||||
}
|
||||
}
|
||||
items_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
items_.RemoveAt(index);
|
||||
}
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
items_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!typeof(TsCDaItem).IsInstanceOfType(value))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!typeof(TsCDaItem).IsInstanceOfType(value))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
|
||||
items_.Insert(index, value);
|
||||
}
|
||||
items_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
items_.Remove(value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
items_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return items_.Contains(value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return items_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
items_.Clear();
|
||||
}
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
items_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return items_.IndexOf(value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return items_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!typeof(TsCDaItem).IsInstanceOfType(value))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!typeof(TsCDaItem).IsInstanceOfType(value))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
|
||||
return items_.Add(value);
|
||||
}
|
||||
return items_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
@@ -266,48 +266,48 @@ namespace Technosoftware.DaAeHdaClient.Da
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCDaItem value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCDaItem value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCDaItem value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCDaItem value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCDaItem value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCDaItem value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCDaItem value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCDaItem value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCDaItem value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user