Get values from textfile with C# -
i've got textfile contains following data:
name = sir age = 23 profile = none birthday= germany manufacturer = me and want profile, birthday , manufacturer value can't seem right. succeded including file program there stops. can't figure out how clean textfile up.
here's current code: http://sv.paidpaste.com/hrqxbg
using system; using system.io; using system.linq;  class program {     static void main()     {         var data = file             .readalllines("test.txt")             .select(x => x.split('='))             .where(x => x.length > 1)             .todictionary(x => x[0].trim(), x => x[1]);          console.writeline("profile: {0}", data["profile"]);         console.writeline("birthday: {0}", data["birthday"]);         console.writeline("manufacturer: {0}", data["manufacturer"]);     } } 
Comments
Post a Comment