المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : i have this code, i need it in class



C# Programming
01-24-2011, 08:31 AM
hi

i have this code:

var lines = File.ReadAllLines(@"d:\text.txt", Encoding.Default);

var questions = new Dictionary();

foreach (var line in lines)

{

var parts = line.Split(new[] { ". " }, StringSplitOptions.RemoveEmptyEntries);

var number = Int32.Parse(parts[0]);

questions.Add(number, parts[1]);

}




i need it in class and that all my forms will

recognize the var questions

how to do it ? can i get any sample code ?



thanks in advance