当前位置: 首页>>代码示例>>C#>>正文


C# Processor.Equals方法代码示例

本文整理汇总了C#中Processor.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Processor.Equals方法的具体用法?C# Processor.Equals怎么用?C# Processor.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Processor的用法示例。


在下文中一共展示了Processor.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public void Create()
        {
            Processor p1 = new Processor(0, "Name", 0x1000, 0x40000, 0x3E000, 0x3FFFF);
            Processor p2 = new Processor(0, "Name", 0x1000, 0x40000, 0x3E000, 0x3FFFF);

            Assert.AreEqual("Name", p1.ToString());
            Assert.AreEqual("Name", p2.ToString());
            Assert.IsTrue(p1.Equals(p2));

            p2.Name = "NewName";

            Assert.AreEqual("NewName", p2.ToString());
            Assert.IsFalse(p1.Equals(p2));
        }
开发者ID:KiselevKN,项目名称:BootMega,代码行数:14,代码来源:ProcessorTests.cs

示例2: ToProcessors

        public void ToProcessors()
        {
            string xElementProcessors =
                "<processors>" + "\r\n  " +
                "<processor ID=\"0\" Name=\"ATMega128\">" + "\r\n    " +
                "<eepromSize>0x1000</eepromSize>" + "\r\n    " +
                "<flashSize>0x20000</flashSize>" + "\r\n    " +
                "<bootStartAddress>0x1E000</bootStartAddress>" + "\r\n    " +
                "<bootEndAddress>0x1FFFF</bootEndAddress>" + "\r\n  " +
                "</processor>" + "\r\n  " +
                "<processor ID=\"1\" Name=\"ATMega2560\">" + "\r\n    " +
                "<eepromSize>0x1000</eepromSize>" + "\r\n    " +
                "<flashSize>0x40000</flashSize>" + "\r\n    " +
                "<bootStartAddress>0x3E000</bootStartAddress>" + "\r\n    " +
                "<bootEndAddress>0x3FFFF</bootEndAddress>" + "\r\n  " +
                "</processor>" + "\r\n" +
                "</processors>";

            XElement xElement = XElement.Parse(xElementProcessors);
            var processors = xElement.ToProcessors(XNamespace.None).ToList();

            Assert.AreEqual(2, processors.Count);

            Processor expectedProcessor1 = new Processor(0, "ATMega128",
                0x1000, 0x20000, 0x1E000, 0x1FFFF);
            Processor expectedProcessor2 = new Processor(1, "ATMega2560",
                0x1000, 0x40000, 0x3E000, 0x3FFFF);

            Assert.IsTrue(expectedProcessor1.Equals(processors[0]));
            Assert.IsTrue(expectedProcessor2.Equals(processors[1]));
        }
开发者ID:KiselevKN,项目名称:BootMega,代码行数:31,代码来源:ProcessorExtensionsTests.cs


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