ちょっと私は C# に不慣れで、チュートリアルに従っていますが、コードでエラーが発生しています... get here ( get; set; ) で「識別子が必要です」と表示され、「無効なトークン」というエラーも表示されます。クラス、構造体、またはインターフェイスのメンバー宣言で」を設定します。
どんな助けでも大歓迎です。
ありがとう!!
public class Invoice
{
public int ID ( get; set; )
public string Description ( get; set; )
public decimal Amount ( get; set; )
}
[TestClass]
public class ReferenceTypesAndValueTypes
{
[TestMethod]
public void IdentityTest()
{
Invoice firstInvoice = new Invoice();
firstInvoice.ID = 1;
firstInvoice.Description = "Test";
firstInvoice.Amount = 0.0M;
Invoice secondInvoice = new Invoice();
secondInvoice.ID = 1;
secondInvoice.Description = "Test";
secondInvoice.Amount = 0.0M;
Assert.IsFalse(object.ReferenceEquals(secondInvoice, firstInvoice));
Assert.IsTrue(firstInvoice.ID == 1);
secondInvoice.ID = 2;
Assert.IsTrue(secondInvoice.ID == 2);
Assert.IsTrue(firstInvoice.ID == 1);
secondInvoice = firstInvoice;
Assert.IsTrue(object.ReferenceEquals(secondInvoice,firstInvoice));
secondInvoice.ID = 5;
Assert.IsTrue(firstInvoice.ID == 5);
}
}