List как передается? - C#
Формулировка задачи:
Как правильно передается List<class>? Никак до конца не могу понять
Вот пускай будет пример:
class MyClass
{
List<string> lstS = new List<string> { "sad", "ags", "sdfsf" };
public void Method()
{
foreach (var item in lstS)
{
Console.WriteLine(item);
}
}
}
class Program
{
static void Main(string[] args)
{
M();
Console.ReadLine();
}
static void M(List<MyClass> m)
{
//Что тут делать?
}
} Решение задачи: «List как передается?»
textual
Листинг программы
public void Save(IEnumerable<Triangle> items)
{
using (var sw = new StreamWriter("Test.txt"))
{
sw.WriteLine("solid ascii");
sw.WriteLine("facet normal 0 0 0");
sw.WriteLine("outer loop");
foreach (var item in items)
{
sw.WriteLine("vertex {0} {1} {2}", item.A, item.B, item.C);
}
sw.WriteLine("end loop");
sw.WriteLine("end facet");
}
}