I have named my button object (WinForms) with all hebrew letters and then added click event... and it worked.
Is this some new lang feature I've missed?
this.כפתור = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// כפתור
//
this.כפתור.Location = new System.Drawing.Point(58, 48);
this.כפתור.Name = "כפתור";
this.כפתור.Size = new System.Drawing.Size(75, 23);
this.כפתור.TabIndex = 0;
this.כפתור.Text = "button1";
this.כפתור.UseVisualStyleBa开发者_如何学编程ckColor = true;
this.כפתור.Click += new System.EventHandler(this.button1_Click);
private void button1_Click(object sender, EventArgs e)
{
כפתור.Text = "BLAH BLAH";
}
C# (also other popular languages like Java) uses unicode character set for its source code. It is not anything new.
I would suggest you not only stick to English letters but also stick to English names for identifiers. It keeps the program naming consistent with the framework and the source code can be maintained by programmers who don't understand your language.
The C# language specification shows what you can and cannot use for identifiers.
http://msdn.microsoft.com/en-us/library/aa664670%28v=VS.71%29.aspx
It basically says that unicode characters are permitted for certain sets of characters, and I'm assuming the set that includes Hebrew is in that list. (I don't know the set name for Hebrew characters sets)
It looks like unicode variable names have been supported for some time, though I've never used them. http://jameskovacs.com/2006/02/16/unicode-variable-names/
精彩评论