forked from wangyx0055/DisklessSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLiteColumnList.cs
103 lines (83 loc) · 2.31 KB
/
SQLiteColumnList.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.Text;
namespace System.Data.SQLite
{
public class SQLiteColumnList : IList<SQLiteColumn>
{
List<SQLiteColumn> _lst = new List<SQLiteColumn>();
private void CheckColumnName(string colName)
{
for (int i = 0; i < _lst.Count; i++)
{
if (_lst[i].ColumnName == colName)
throw new Exception("Column name of \"" + colName + "\" is already existed.");
}
}
public int IndexOf(SQLiteColumn item)
{
return _lst.IndexOf(item);
}
public void Insert(int index, SQLiteColumn item)
{
CheckColumnName(item.ColumnName);
_lst.Insert(index, item);
}
public void RemoveAt(int index)
{
_lst.RemoveAt(index);
}
public SQLiteColumn this[int index]
{
get
{
return _lst[index];
}
set
{
if (_lst[index].ColumnName != value.ColumnName)
{
CheckColumnName(value.ColumnName);
}
_lst[index] = value;
}
}
public void Add(SQLiteColumn item)
{
CheckColumnName(item.ColumnName);
_lst.Add(item);
}
public void Clear()
{
_lst.Clear();
}
public bool Contains(SQLiteColumn item)
{
return _lst.Contains(item);
}
public void CopyTo(SQLiteColumn[] array, int arrayIndex)
{
_lst.CopyTo(array, arrayIndex);
}
public int Count
{
get { return _lst.Count; }
}
public bool IsReadOnly
{
get { return false; }
}
public bool Remove(SQLiteColumn item)
{
return _lst.Remove(item);
}
public IEnumerator<SQLiteColumn> GetEnumerator()
{
return _lst.GetEnumerator();
}
Collections.IEnumerator Collections.IEnumerable.GetEnumerator()
{
return _lst.GetEnumerator();
}
}
}