Hi Greg,

Character and string processing in C# uses Unicode encoding - all characters 
are 16-bit.

The rules for Identifiers can be found in section 2.4.2 of The C# Programming 
Language, 4th Edition, Hejlsberg, Torgersen, Wiltamuth, Golde.  Read it here: 
http://msdn.microsoft.com/en-us/library/aa664670(v=vs.71).aspx.

Cheers,
Chris

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On 
Behalf Of Greg Keogh
Sent: Wednesday, 26 June 2013 11:11 AM
To: ozDotNet
Subject: Character set for variable names

Folk, I have some utility code that saves the names and values of object 
properties. I was wondering if the property names could be stored as ASCII or 
would be more space. So I coded this and found it works.

int ΑΒΓΔθ = 123;
long y = 891723;
var z = ΑΒΓΔθ + y;

(If my pasting fails) the first variable is Greek [alpha, beta, gamma, delta, 
phi]. I'd never thought about this before, and was a little surprised to see it 
works, but I guess I'm biased by living in a mostly ASCII world. I had a quick 
look at the C# spec online, but I can't find any specific statement about what 
characters are acceptable for variable names. I'm guessing it's Unicode letter 
and number category characters, which is quite few I reckon! Anyway, so I need 
an NVARCHAR field to store the property names.

Greg K

Reply via email to