我是C#的新手并不熟悉它.我很困惑与区别new PostpaidProfile();和default(AutoliftResult);我的意思是什么是对他们是如何调用的差异.下面是我不知道它们被称为什么的类或对象
public class PostpaidProfile
{
public bool WasRetrieved { get; set; }
public string AccountCategory { get; set; }
public string AccountNum { get; set; }
public string Acd { get; set; }
public string ActivationDate { get; set; }
public int? AgingDays { get; set; }
public decimal? CreditRating { get; set; }
public string CutOff { get; set; }
public string Cycle { get; set; }
public bool? IsBlacklisted { get; set; }
public bool? IsNopsa { get; set; }
public decimal? Msf { get; set; }
public string RatePlan { get; set; }
public string ServiceStatus { get; set; }
public int? VipCode { get; set; }
public string Zip { get; set; }
public string Remarks { get; set; }
}
public class AutoliftResult
{
public bool IsSuccess { get; set; }
public decimal StatusCode { get; set; }
public string Message { get; set; }
public string SRNumber { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
在这里如何调用它们
PostpaidProfile output = new PostpaidProfile();
AutoliftResult output = default(AutoliftResult);
Run Code Online (Sandbox Code Playgroud)
我的问题是他们的区别是什么?(我不是在谈论他们的内容)如果我宣布它是一样的AutoliftResult output = new AutoliftResult();
new PostpaidProfile() 创建一个新的类实例.
default(AutoliftResult)为指定的类型创建默认值.对于参考类型,它是null.对于值类型,它通常0是为类型转换的任何内容- 即如果类型是int,则默认值为0; 如果是类型bool,则默认值为false,等等.
| 归档时间: |
|
| 查看次数: |
317 次 |
| 最近记录: |