【发布时间】:2011-03-14 20:07:47
【问题描述】:
在 c# 初始化程序中,如果条件为假,我不想设置属性。
类似这样的:
ServerConnection serverConnection = new ServerConnection()
{
ServerInstance = server,
LoginSecure = windowsAuthentication,
if (!windowsAuthentication)
{
Login = user,
Password = password
}
};
可以吗? 怎么样?
【问题讨论】:
标签: c# initializer