更新时间:2022-12-12 09:14:04
您在List< t>中有Revesre和ToArray方法,这是什么问题?
请参阅: http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx [^ ]
要查看如何使用反射器实现该功能,请在Visual Studio中启用.net源调试,或为其源代码启用google.
You have Revesre and ToArray methods in List<t>, what''s the problem?
See: http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx[^]
To see how it is implemented use reflector, enable .net source debugging in visual studio, or google for it''s source code.
List<string> dinosaurs = new List<string>();
dinosaurs.Add("Pachycephalosaurus");
dinosaurs.Add("Parasauralophus");
dinosaurs.Add("Mamenchisaurus");
dinosaurs.Add("Amargasaurus");
dinosaurs.Add("Coelophysis");
dinosaurs.Add("Oviraptor");
string[] input = dinosaurs.Reverse().ToArray();
List<string> list = new List<string>();
list.Add("C++");
list.Add("C#");
list.Add("Java");
list.Add("Objective-C");
list.Reverse();
string[] array = list.ToArray();
for (int i = 0; i < array.Length; i++)
{
Console.WriteLine(array[i]);
}