本文整理汇总了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));
}
示例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]));
}