📄 banktransaction.cs
字号:
using System;
using System.IO;
namespace Banking
{
/// <summary>
/// This class holds information about a transaction (deposit/withdraw)
/// performed on an account
/// </summary>
public class BankTransaction
{
private readonly DateTime tranDate = DateTime.Now;
private readonly decimal tranAmount;
// Destructor (Finalizer)
~BankTransaction()
{
StreamWriter swFile = File.AppendText("C:\\temp\\Transactions.dat");
swFile.WriteLine("Date: {0}\tAmount: {1}", this.tranDate, this.tranAmount);
swFile.Close();
}
public void Dispose()
{
this.Finalize();
GC.SuppressFinalize(this);
}
public BankTransaction(decimal theAmount)
{
this.tranAmount = theAmount;
}
public decimal Amount
{
get { return tranAmount; }
}
public DateTime When
{
get { return tranDate; }
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -