I wrote a DLL file, that contains a StringCollection.
If you add a reference to this file, the StringCollection Class will become aviable in the System.Collections namespace !
You can use it like this:
private System.Collections.StringCollection strs;
public void Test()
{
strs = new System.Collections.StringCollection();
strs.LoadFromFile(@"c:\test.txt");
}
The following functions are defined:
Add(string text)
Remove(int index)
And ofcourse you can get/set items like this: strs[x] = "somestring"; somestring = strs[x];
I think, I miss your point... What do you want to do by that code???
There is ArrayList class which is container and you can use it to store string objects. Or if you need other container, there is Hashtable class which is something as map...
If you need to make strings from the bytes, why don't use
System.Text.Encoding.ASCII.GetBytes(byte[] bytes, int index, int count);
function???
If you need to read the file and parse it into the lines, why don't use StreamReader class and String.Split function?
Code:
StreamReader sr = new StreamReader("file.dat");
ArrayList arr = new ArrayList(sr.ReadToEnd().Replace("\r\n", "\n").Split('\n'));
foreach (string s in arr)
{
// iterate for all lines in the file file.dat... the line is in the s variable...
}
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.