📄 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
{
readonly DateTime tranDate = DateTime.Now;
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();
}
internal void Dispose()
{
this.Finalize();
GC.SuppressFinalize(this);
}
internal BankTransaction(decimal theAmount)
{
this.tranAmount = theAmount;
}
public decimal Amount()
{
return tranAmount;
}
public DateTime When()
{
return tranDate;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -