Правильный вызов метода - C#
Формулировка задачи:
class Dict{
public List<Word> words;
public Dict(){
words = new List<Word>();
}
public void AddWord(string word, string[] translates){
words.Add(new Word(word, translates));
}
public void OpenFromXML(){
Stream st =
new FileStream(
"путь/dictionary.txt",
FileMode.Open);
XmlSerializer f = new XmlSerializer(words.GetType());
XmlReader reader = XmlReader.Create(st);
words = (List<Word>) f.Deserialize(reader);
st.Close();
}
}class Program{
static void Main(string[] args){
Dict dictionary = new Dict();
dictionary.OpenFromXML();
Console.ReadLine();
}
}Решение задачи: «Правильный вызов метода»
textual
Листинг программы
static void Main(string[] args)
{
Dict dictionary = new Dict();
dictionary.OpenFromXML();
foreach (string word in dict.words)
{
Console.WriteLine(word);
}
Console.ReadLine();
}