void Foo()
{
string ID = "test";
var testctrl = new Control() {ID = (ID**!=null?ID**:ID)};
}
能否将ID**的价值纳入上述法典? 问题是他们都有相同的财产名称。
请忽视这样一个事实,即身份证的具体转让是毫无意义的,只是将其作为一个例子。
void Foo()
{
string ID = "test";
var testctrl = new Control() {ID = (ID**!=null?ID**:ID)};
}
能否将ID**的价值纳入上述法典? 问题是他们都有相同的财产名称。
请忽视这样一个事实,即身份证的具体转让是毫无意义的,只是将其作为一个例子。
Putting aside that the code can t possibly compile...
The first ID
(ID=
) in this syntax refers to the assignment, specifically the member being assigned. On the right-hand-side, it comes down to standard resolution. Which never means the ID
of the new object. It will first look at the local ID
variable, then after that members (fields etc) on the current instance. To prefer members on the current instance, use this.ID
.
您也不妨考虑取消销售的经营人,这样,如果你指的是“当地负债者,或者如果无效的话,那将是
首先对这条线说几句,它看着奇怪的(把铺设为ool):
bool ID = "test";
第二点是,这部作品是:
string ID = "test";
var testctrl = new Control(){ ID = (ID==null?ID:ID) };
第三点:它是在C#中的一项公约,用下级文字来标明您的地方变量。
如果你想要检查新的控制是否无效,那么你应该这样做。
void Foo()
{
string ID = "test";
var testctrl = new Control();
if(testctrl.ID==null)
testctrl.ID = ID;
}
问题不是我所清楚的,而是你们想要做到:
void Foo()
{
bool ID = "test";
var testctrl = new Control(){ID = (this.ID==null?ID:this.ID)};
}
注:未经测试。
Seeing your example, I suspect that you don t have the requirement that the ID should be unique? In general, to avoid nasty problems like this, avoid try using duplicate property names, but maybe your bound to an existing interface.
• 如何增加一个将外部识别作为参数的构件超负荷?
void Foo()
{
string ID = "test";
var testctrl = new Control(ID);
}
我认为,一般而言,如果财产不仅仅只是转让(在这种情况下进行清点检查),那么你就应当在一套财产本身,而不是在标的初始阶段这样做。
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...