• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Computer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Computer的典型用法代码示例。如果您正苦于以下问题:C# Computer类的具体用法?C# Computer怎么用?C# Computer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Computer类属于命名空间,在下文中一共展示了Computer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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("-----------------");
        }
    }
开发者ID:i-yotov,项目名称:Courses,代码行数:29,代码来源:PCCatalogMain.cs


示例2: Claim

 /// <summary>
 /// Called while the ProcessWaiter is locked: attempt to bind the computer to a process;
 /// this fails if it has already been bound to another process. The ProcessWaiter may
 /// be entered into multiple scheduling queues, and the first time it reaches the head
 /// of a queue it will be claimed successfully; it will be dropped after reaching the
 /// heads of other queues
 /// </summary>
 public Computer Claim()
 {
     System.Diagnostics.Debug.Assert(computer != null);
     Computer ret = computer;
     computer = null;
     return ret;
 }
开发者ID:knowledgehacker,项目名称:Dryad,代码行数:14,代码来源:Queues.cs


示例3: Export

        private static void Export(Computer data, string format, string outfile, string[] categories)
        {
            string outstr = "";
            switch (format)
            {
                case "txt":
                    outstr = ExportTxt(data, categories);
                    break;

                case "csv":
                    //outstr = data.ToCsv();
                    break;
            }
            if (outfile != null)
            {
                System.IO.StreamWriter file = new System.IO.StreamWriter(outfile);
                file.WriteLine(outstr.Replace("\n", "\r\n"));

                file.Close();
            }
            else
            {
                Console.WriteLine(outstr);
                // print to screen
            }
        }
开发者ID:sapozhnikovay,项目名称:wminfo,代码行数:26,代码来源:Program.cs


示例4: Main

    static void Main()
    {
        List<Computer> catalog = new List<Computer>();
        List<Component> components1 = new List<Component>();
        components1.Add(new Component("HDD", 500.00m));
        components1.Add(new Component("CPU", 250.12m));
        Computer hp = new Computer("HP", components1);

        List<Component> components2 = new List<Component>();
        components2.Add(new Component("CPU", 400.01m));
        components2.Add(new Component("RAM", 102.00m));
        components2.Add(new Component("Graphics card", 100));
        Computer sony = new Computer("Sony", components2);


        catalog.Add(hp);
        catalog.Add(sony);

        var sortCatalog = catalog.OrderBy(computer => computer.Price);

        foreach (var computer in sortCatalog)
        {
            Console.WriteLine(computer);
        }
    }
开发者ID:emilrr,项目名称:SoftUni-Fundamental-Level,代码行数:25,代码来源:PCCatalog.cs


示例5: Main

    static void Main()
    {
        Component graphicsCard = new Component("nVidia", 350m);
        Component hdd = new Component("WesternDigital", 130m, "1TB 3.5 HDD (7200 оборота/минута)");
        Component ram = new Component("AsRock", 210m, "8GB (2x 4096MB) - DDR3, 1600Mhz");
        Component motherboard = new Component("AsRock", 520m);
        Component processor = new Component("Intel", 600m, "Core i5-4460 (4-ядрен, 3.20 - 3.40 GHz, 6MB кеш)");
        Component powerSupply = new Component("Superpowerrr", 250m, "5000W");
        Component biggerHdd = new Component("WesternDigital", 189m, "2TB 3.5 HDD");

        Computer lenovo = new Computer("Lenovo", graphicsCard, hdd, ram, motherboard, processor, powerSupply);
        Computer dell = new Computer("Dell", graphicsCard, biggerHdd, ram, motherboard, processor, powerSupply);
        Computer acer = new Computer("Acer", graphicsCard, ram, processor, motherboard);

        List<Computer> computers = new List<Computer>();
        computers.Add(lenovo);
        computers.Add(dell);
        computers.Add(acer);

        computers = computers.OrderBy(computer => computer.Price).ToList();

        foreach (var computer in computers)
        {
            computer.printInfo();
            Console.WriteLine();
        }

    }
开发者ID:vvulevv,项目名称:OOP-Defining-Class,代码行数:28,代码来源:PCCatalog.cs


示例6: Main

    private static void Main()
    {
        List<Computer> computers = new List<Computer>();

        Computer PC1 = new Computer(
                name: "ASUS",
                motherboard: new Component("Asus AK-47", 334m, "mini form factor"),
                processor: new Component("i7 2345", 234m, "64 cores"),
                ram: new Component("32GB", 200m, "DDR5"));

        Computer PC2 = new Computer(
            name: "GigaBUUUG",
            motherboard: new Component("Gigabyte AZ32", 144m, "mini form factor"),
            processor: new Component("i5 2345", 134m, "32 cores"),
            ram: new Component("16GB", 100m, "DDR5"));

        Computer PC3 = new Computer(
            name: "Handmade",
            motherboard: new Component("Marmalad duno", 112m),
            processor: new Component("i3 2200", 104m),
            ram: new Component("8GB", 80m));

        computers.Add(PC1);
        computers.Add(PC2);
        computers.Add(PC3);

        computers = computers.OrderBy(o => o.totalPrice).ToList();

        foreach (var computer in computers)
        {
            Console.WriteLine(computer);
            Console.WriteLine();
        }
    }
开发者ID:dimitarIT,项目名称:2.1.OOP,代码行数:34,代码来源:PC_Catalogue.cs


示例7: Calculate

    private decimal Calculate(Computer computer)
    {
        var components = computer.Components;
        decimal price = components.Sum(component => component.Price);

        return price;
    }
开发者ID:DimitarLilov,项目名称:Object-Oriented-Programming,代码行数:7,代码来源:Computer.cs


示例8: Main

    static void Main()
    {
        // Play a sound with the Audio class:
        Audio myAudio = new Audio();
        Console.WriteLine("Playing sound...");
        myAudio.Play(@"c:\WINDOWS\Media\chimes.wav");

        // Display time information with the Clock class:
        Clock myClock = new Clock();
        Console.Write("Current day of the week: ");
        Console.WriteLine(myClock.LocalTime.DayOfWeek);
        Console.Write("Current date and time: ");
        Console.WriteLine(myClock.LocalTime);

        // Display machine information with the Computer class:
        Computer myComputer = new Computer();
        Console.WriteLine("Computer name: " + myComputer.Name);

        if (myComputer.Network.IsAvailable)
        {
            Console.WriteLine("Computer is connected to network.");
        }
        else
        {
            Console.WriteLine("Computer is not connected to network.");
        }
    }
开发者ID:terryjintry,项目名称:OLSource1,代码行数:27,代码来源:how-to--use-the-my-namespace--csharp-programming-guide-_2.cs


示例9: Main

    static void Main(string[] args)
    {
        Component intelGraphicsCard = new Component("Intel HD Graphics 4400", "Mnogo moshtna", 499.0m);
        Component asrockMotherboard = new Component("Asrock 123412", 199.0m);
        Component intelProcessor = new Component("Intel i5 43-123512", 600.0m);

        Computer MyComp = new Computer("Lenovo", new List<Component> { intelGraphicsCard, asrockMotherboard, intelProcessor });


        Component nvidiaGraphicsCar = new Component("NVIDIA GeForce GTX 880M", " (4GB GDDR5)", (decimal)1000);
        Component inteli7Processor = new Component("Intel Core i7-4700HQ", "(4-ядрен, 2.40 - 3.40 GHz, 6MB кеш)", (decimal)300);
        Component asusMotherboard = new Component("Asus Motherboard", (decimal)200);

        Computer otherComp = new Computer("Asus", new List<Component> { nvidiaGraphicsCar, inteli7Processor, asusMotherboard });

        Component nGraphic = new Component("NVIDIA GeForce GTX 100000", " (64GB GDDR8)", (decimal)80000);
        Component i8Processor = new Component("Intel i8 NNNN", (decimal)1000);
        Component AMotherboard = new Component("Motherboard", (decimal)900);

        Computer mostExpensive = new Computer("HP", new List<Component> { nGraphic, i8Processor, AMotherboard});

        List<Computer> computers = new List<Computer>() { mostExpensive, otherComp, MyComp,};

        computers.OrderByDescending(computer => computer.Price).ToList().ForEach(computer => Console.WriteLine(computer.ToString()));
    }
开发者ID:StanislavBozhilov,项目名称:SoftwareUniversity,代码行数:25,代码来源:PCCatalog.cs


示例10: JSONSystemData

    public JSONSystemData(Computer computer, bool names)
    {
        // Create lists
        Voltages = new List<JSONNameValue>();
        Temp = new List<JSONNameValue>();
        Fans = new List<JSONNameValue>();

        // Find the superIO chip.
        IHardware motherboard = computer.Hardware.FirstOrDefault(h => h.HardwareType == HardwareType.Mainboard && h.SubHardware.Length > 0);
        IHardware superIO;

        if (motherboard != null) {
            superIO = motherboard.SubHardware[0];

            foreach (ISensor s in superIO.Sensors) {
                String name;
                if (names) name = s.Name;
                else name = "";

                switch (s.SensorType) {
                    case SensorType.Voltage: Voltages.Add(new JSONNameValueFloat(name, (float)s.Value, 3)); break;
                    case SensorType.Fan: Fans.Add(new JSONNameValueInt(name, (int)s.Value)); break;
                    case SensorType.Temperature: Temp.Add(new JSONNameValueFloat(name, (float)s.Value, 1)); break;
                }
            }
        }
    }
开发者ID:sakisds,项目名称:Icy-Monitor,代码行数:27,代码来源:JSONSystemData.cs


示例11: Insert

 ///<summary>Inserts one Computer into the database.  Returns the new priKey.</summary>
 internal static long Insert(Computer computer)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         computer.ComputerNum=DbHelper.GetNextOracleKey("computer","ComputerNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(computer,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     computer.ComputerNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(computer,false);
     }
 }
开发者ID:nampn,项目名称:ODental,代码行数:26,代码来源:ComputerCrud.cs


示例12: Get_test

        public void Get_test()
        {
            // arrange
            var maker = "Intel";
            var processorSpeed = 500;
            var ramSize = 2000;
            processors[0] = new Dictionary<string, object>
            {
                { "Maker", maker},
                { "Speed", processorSpeed},
                { "RamId", 0 }
            };
            rams[0] = new Dictionary<string, object>
            {
                { "Size", ramSize }
            };
            var aggregatorProvider = aggregatorProviderMock.Object;
            var processorModel = new ProcessorModel(0, processorCollectionMock.Object);
            var ramModel = new RAMModel(0, ramCollectionMock.Object);
            var computer = new Computer(aggregatorProvider, processorModel);
            var ram = new RAM(aggregatorProvider, ramModel);
            aggregatorProvider.Save(computer, ram);

            // act and assert
            computer.RAM.Size.Should().Be(ramSize);
            computer.ProcessorSpeed.Should().Be(processorSpeed);
            computer.Maker.Should().Be(maker);
        }
开发者ID:iroq,项目名称:trellis,代码行数:28,代码来源:NestedLazyAggregatorTests.cs


示例13: ComputeEngine

    public ComputeEngine(FractalSettings settings)
    {
        int height = settings.Height;		// note that we need to use these locals to avoid creating tens of thousands of BigFloat objects in the loop
        int width = settings.Width;
        m_samples = new float[width, height];
        for (int v = 0; v < height; ++v)
            for (int h = 0; h < width; ++h)
                m_samples[h, v] = float.NaN;

        //		Console.WriteLine("dx: {0:F}", settings.Extent.Width/width);

        const int NumThreads = 4;
        m_computers = new Computer[NumThreads];

        int startRow = 0;
        int numRows = height/NumThreads;
        for (int i = 0; i < NumThreads; ++i)
        {
            if (i + 1 == NumThreads)
                numRows = height - startRow;

            m_computers[i] = new Computer(settings, startRow, numRows, m_samples);
            startRow += numRows;
        }
    }
开发者ID:afrog33k,项目名称:mcocoa,代码行数:25,代码来源:ComputeEngine.cs


示例14: JSONGPUData

    public JSONGPUData(Computer computer, bool names)
    {
        // Create lists
        Temp = new List<JSONNameValue>();
        Fans = new List<JSONNameValue>();
        Load = new List<JSONNameValue>();
        Clock = new List<JSONNameValue>();

        IEnumerable<IHardware> gpus = computer.Hardware.Where(h => h.HardwareType == HardwareType.GpuNvidia || h.HardwareType == HardwareType.GpuAti);

        foreach (IHardware h in gpus) {
            foreach (ISensor s in h.Sensors) {
                String name;
                if (names) name = s.Name;
                else name = "";

                switch (s.SensorType) {
                    case SensorType.Temperature: Temp.Add(new JSONNameValueFloat(name, (float)s.Value)); break;
                    case SensorType.Fan: Fans.Add(new JSONNameValueInt(name, (int)s.Value)); break;
                    case SensorType.Load: Load.Add(new JSONNameValueInt(name, (int)s.Value)); break;
                    case SensorType.Clock: Clock.Add(new JSONNameValueInt(name, (int)s.Value)); break;
                }
            }
        }
    }
开发者ID:sakisds,项目名称:Icy-Monitor,代码行数:25,代码来源:JSONGPUData.cs


示例15: Main

    static void Main(string[] args)
    {
        Component ram1 = new Component("8GB RAM", 116);
        Component ram2 = new Component("4GB RAM", 72);

        Component hdd1 = new Component("500GB HHD", 78);
        Component hdd2 = new Component("1TB HDD", 131);
        Component hdd3 = new Component("1TB SSD", 370);

        Component gpu1 = new Component("None", 0);
        Component gpu2 = new Component("ATI 5890", 255);
        Component gpu3 = new Component("NVidia GTX Titan", 598);

        Component cpu1 = new Component("Intel Core i3 2.4 GHz", 78);
        Component cpu2 = new Component("Intel Core i5 3.2 GHz", 131);
        Component cpu3 = new Component("Intel Core i7 4.0 GHz", 515);

        Computer PC1 = new Computer("PC1", new List<Component>() { ram1, hdd1, gpu1, cpu1 });
        Computer PC2 = new Computer("PC2", new List<Component>() { ram2, hdd2, gpu2, cpu2 });
        Computer PC3 = new Computer("PC4", new List<Component>() { ram1, hdd3, gpu3, cpu3 });
        Computer PC4 = new Computer("UnknownTrash");

        List<Computer> myList = new List<Computer>() { PC1, PC2, PC3, PC4 };
        myList = myList.OrderBy(pr => pr.Price).ToList();
        foreach (var pc in myList)
        {
            Console.WriteLine(pc.ToString());
        }
    }
开发者ID:rextor92,项目名称:OOP-November2015,代码行数:29,代码来源:Test.cs


示例16: Main

        static void Main()
        {
            Components mcardVLC = new MotherBoard("VLC", (decimal)185.98);
            Components vcardRadeon = new GraphicsCard("Radeon", (decimal)102.34, "the best grafic card forever");
            Components vcardGeForce = new GraphicsCard("GeForce", (decimal)154.45, "is not worth");

            Components procIntel = new Processor("Intel", (decimal)346.563, "can be better");
            Components procAMD = new Processor("AMD", (decimal)405.239, "always the best");
            Components procMac = new Processor("IOS", 2000m, "It is okaaaay");

            Computer mac = new Computer("Mac", new List<Components>() { mcardVLC, vcardRadeon, vcardGeForce });
            Computer windows = new Computer("Windows");
            windows.Components.Add(procIntel);
            windows.Components.Add(procAMD);
            windows.Components.Add(procMac);
            //Console.WriteLine(windows);

            Computer linux = new Computer("Linux", new List<Components>() { mcardVLC, vcardGeForce, vcardRadeon, procAMD, procIntel, procMac });

            List<Computer> computers = new List<Computer>() { mac, windows, linux };

            computers.OrderBy(p => p.TotalPrice).ToList().ForEach(p => Console.WriteLine(p.ToString()));


            //or

            //computers.OrderBy(a => a.TotalPrice);

            //foreach (var computer in computers)
            //{
            //    Console.WriteLine(computer);
            //}
        }
开发者ID:ScreeM92,项目名称:Software-University,代码行数:33,代码来源:Test.cs


示例17: AddInteractions

 public override void AddInteractions(InteractionObjectPair iop, Sim actor, Computer target, List<InteractionObjectPair> results)
 {
     foreach (AfterschoolActivityData data in AfterschoolActivityBooter.Activities.Values)
     {
         results.Add(new InteractionObjectPair(new Definition(data.mActivity.CurrentActivityType), iop.Target));
     }
 }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:7,代码来源:ComputerTakeChildOutOfAfterschoolClassEx.cs


示例18: ComputerPrice

    public decimal ComputerPrice(Computer computer)
    {
        var components = computer.Components;
        decimal totalSum = components.Sum(component => component.Price);

        return totalSum;
    }
开发者ID:antonvatkov,项目名称:repositorySoftUni,代码行数:7,代码来源:3.Computer.cs


示例19: Main

        static void Main(string[] args)
        {
            Components ram1 = new Components("2GB RAM", 20);
            Components ram2 = new Components("6GB RAM", 60);

            Components hdd1 = new Components("1TB HHD", 350);
            Components hdd2 = new Components("250GB HDD", 131);
            Components hdd3 = new Components("2TB SSD", 640);

            Components gpu1 = new Components("No Info", 0);
            Components gpu2 = new Components("ATI Radeon HD 5500", 65);
            Components gpu3 = new Components("NVidia GTX Titan", 650);

            Components cpu1 = new Components("Intel Core i3 2.4 GHz", 65);
            Components cpu2 = new Components("Intel Core i7 4.0 GHz", 315);
            Components cpu3 = new Components("Intel Core i5 3.2 GHz", 135);

            Components motherboard = new Components("Motherboard :AMD",200);
            Components motherboard2 = new Components("Motherboard Intel", 500);

            Computer PC1 = new Computer("PC1", new List<Components>() { ram2, hdd1, gpu1, cpu1,motherboard2 });
            Computer PC2 = new Computer("PC2", new List<Components>() { ram1, hdd2, gpu2, cpu2,motherboard });
            Computer PC3 = new Computer("PC4", new List<Components>() { ram1, hdd3, gpu3, cpu3,motherboard });
            Computer PC4 = new Computer("UnknownTrash");

            List<Computer> myList = new List<Computer>() { PC1, PC2, PC3, PC4 };
            myList = myList.OrderBy(pr => pr.Price).ToList();
            foreach (var pc in myList)
            {
                Console.WriteLine(pc.ToString());
            }
        }
开发者ID:AlexanderDimitrov,项目名称:OOP,代码行数:32,代码来源:Program.cs


示例20: Main

    static void Main()
    {
        var computerOne = new Computer("Pentagon 4", new List<Component>()
        {
            new Component("processor", 4532.4321),
            new Component("graphics card", 459, "Intel HD Graphics 4400" ),
            new Component("screen", 200, "13.3 (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display")
        });
        var computerTwo = new Computer("Pentagon 2 test", new List<Component>());
        try
        {
            var computerThree = new Computer("Pentagon 3 experiments", new List<Component>()
            {

            //    new Component("", 341.432),
              //  new Component("Processor", - 2142.435, "perfect condition" ),
                new Component(null, 2512, "good condition"),
                new Component("graphics", 241, "")
            });

            Console.WriteLine(computerThree);
        }
         catch(ArgumentException e)
        {
            Console.WriteLine(e.Message);
        }
        Console.WriteLine(computerOne);
        Console.WriteLine(computerTwo);
    }
开发者ID:petdakov,项目名称:SoftUni-Homeworks,代码行数:29,代码来源:Catalogue.cs



注:本文中的Computer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ConcreteApiController类代码示例发布时间:2022-05-24
下一篇:
C# ComputeMemoryFlags类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap