本文整理汇总了C#中GSM.CalculateCallsPrice方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.CalculateCallsPrice方法的具体用法?C# GSM.CalculateCallsPrice怎么用?C# GSM.CalculateCallsPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSM
的用法示例。
在下文中一共展示了GSM.CalculateCallsPrice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
GSM gsm = new GSM("Galaxy S3", "Samsung");
gsm.AddCall(new Call(DateTime.Now, "5551337", 150));
gsm.AddCall(new Call(DateTime.Now.AddDays(-1), "5551337", 230));
gsm.AddCall(new Call(new DateTime(2013, 2, 19), "5551337", 420));
foreach (var call in gsm.CallHistory)
{
Console.WriteLine(call);
}
Console.WriteLine("{0:C}", gsm.CalculateCallsPrice(0.37M));
//get the longest call;
Call maxCall = gsm.CallHistory.Where(x => x.Duration == gsm.CallHistory.Max(y => y.Duration)).Single();
//remove the longest call from the call history
gsm.RemoveCall(maxCall);
//print the total price without the longest call
Console.WriteLine("{0:C}", gsm.CalculateCallsPrice(0.37M));
gsm.ClearCallHistory();
foreach (var call in gsm.CallHistory)
{
Console.WriteLine(call);
}
}