本文整理汇总了C#中Computer.Display方法的典型用法代码示例。如果您正苦于以下问题:C# Computer.Display方法的具体用法?C# Computer.Display怎么用?C# Computer.Display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Computer
的用法示例。
在下文中一共展示了Computer.Display方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
var cpu = new Component("Generic CPU", "100 lv.");
var videocard = new Component("Generic Video Card", "200 lv.", "overpriced");
var motherboard = new Component("Generic Motherboard", "300 lv.");
var hdd = new Component("Generic HDD", "5 lv.", "Opisanieeee");
var videocard2 = new Component("NVIDIA", "999 lv.", "Oshte opisanieeeee");
var computer = new Computer("Kumputar", "6 lv.", cpu, videocard, motherboard);
var computer2 = new Computer("Po-qk kumputar", "3 lv.", cpu, videocard, motherboard, hdd);
var computer3 = new Computer("Nai-qkq kumputar", "4 lv.", cpu, videocard2, motherboard, hdd);
computer2.Display();
Console.WriteLine();
var computerList = new List<Computer>()
{
computer,
computer2,
computer3
};
var sortedComputerList = computerList.OrderBy(x => x.Price); //original price, not total price
foreach (var pc in sortedComputerList)
{
pc.Display();
Console.WriteLine("-----------------");
}
}