From d33c19b3ac6803de4b5c8d475832efef131c1a45 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 30 Dec 2020 15:11:34 +0000 Subject: Revert "Hope it is fine" --- .../SQL/RemoteSqlColumnCollection.cs | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs new file mode 100644 index 000000000..dfda6c3b7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + /// + /// Represents a columns collection. + /// + /// + public class RemoteSqlColumnCollection : Collection + { + private Dictionary _dictionary; + + /// + /// Initializes a new instance of the class. + /// + public RemoteSqlColumnCollection() + { + _dictionary = new Dictionary(); + } + + /// + /// Inserts an element into the at the specified index. + /// + /// The zero-based index at which should be inserted. + /// The object to insert. The value can be null for reference types. + protected override void InsertItem(int index, RemoteSqlColumn item) + { + item.Index = Count; + _dictionary.Add(item.Name, item); + base.InsertItem(index, item); + } + + /// + /// Removes the element at the specified index of the . + /// + /// The zero-based index of the element to remove. + /// + protected override void RemoveItem(int index) + { + throw new NotSupportedException(); + } + + /// + /// Removes all elements from the . + /// + protected override void ClearItems() + { + _dictionary.Clear(); + base.ClearItems(); + } + + /// + /// Replaces the element at the specified index. + /// + /// The zero-based index of the element to replace. + /// The new value for the element at the specified index. The value can be null for reference types. + /// + protected override void SetItem(int index, RemoteSqlColumn item) + { + throw new NotSupportedException(); + } + + /// + /// Gets the column index by column name. + /// + /// Column name. + /// + public int GetIndexOf(String columnName) + { + return _dictionary[columnName].Index; + } + } +} -- cgit v1.3.1