Added Tests. Added Contains method
This commit is contained in:
parent
a032e495cf
commit
5b429b82fa
2 changed files with 67 additions and 2 deletions
|
|
@ -28,14 +28,32 @@ public class FlexArrayString
|
|||
_data = new string[size];
|
||||
}
|
||||
|
||||
public void Add(string input)
|
||||
public void Add(string value)
|
||||
{
|
||||
if (Capacity == Count)
|
||||
{
|
||||
Grow();
|
||||
}
|
||||
|
||||
_data[Count++] = input;
|
||||
_data[Count++] = value;
|
||||
}
|
||||
|
||||
public bool Contains(string value)
|
||||
{
|
||||
if (Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
if (_data[i] == value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void Grow()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue