c# - Get variables from text File -
i have text file each item in <> , sepperated , there no spaces.
i need able read total number of records , asign variable.
also need asign each item in row variable , number of row variable. can processed later.
i have search internet seem going in circles, or source ideas appriciated.
instructions not clear, give try.
using system; using system.data; using system.io; using system.collections.generic; class test { public dictionary<int, string> readandsortfile() { streamreader sr = new streamreader("file.txt"); dictionary<int, string> dic = new dictionary<int, string>(); int loop = 0; while (!sr.endofstream) { dic.add(loop, sr.readline()); loop++; } sr.close(); return dic; } }
your result should this:
[0] {[0, <a>]} [1] {[1, <b>]} [2] {[2, <c>]}
Comments
Post a Comment