C# 这行代码要求什么?
这段代码是别人写的。我正在试图解决我们系统中的一个错误。我不熟悉:C# 这行代码要求什么?,c#,null,C#,Null,这段代码是别人写的。我正在试图解决我们系统中的一个错误。我不熟悉: public Schedule Schedule { get { return (ContractConsignee == null ? null : ContractConsignee.Schedule); } set { if (ContractConsignee == null)
public Schedule Schedule
{
get
{
return (ContractConsignee == null ? null : ContractConsignee.Schedule);
}
set
{
if (ContractConsignee == null)
{
ContractConsignee = new ContractConsignee(Session);
ContractConsignee.Assignments.Add(this);
}
ContractConsignee.Schedule = value;
}
}
?:是的
如果ContractDelegator为null,则getter返回null;否则,它将返回Contract收货人.Schedule
相当于/简称
return (ContractConsignee == null ? null : ContractConsignee.Schedule);
这是一个三元运算符:除了C和MSDN-@Rahul how return ContractDelegator之外,Microsoft还提供搜索引擎。计划相当于return ContractDelegator==null?空:合同收货人。时间表?
return (ContractConsignee == null ? null : ContractConsignee.Schedule);
if (ContractConsignee == null)
{
return null;
}
else
{
return ContractConsignee.Schedule;
}