For the past two days or so, I began my adventures learning a Microsoft-centric programming language called C#. (Yes, this means I have to use Windows 7 instead of Linux on my QuadBox.) It seems relatively useful to know, and it's always nice to know more programming languages. Right now I'm still working through the basics and getting to know the language. Without further ado I shall present two niceties.
Append an @ before a keyword to use it as a variable name:
int @new = 5;
Console.WriteLine(@new); // outputs 5
Create nullable booleans! The book just put this in the beginning to show that such a feature exists, but goes into more detail later. It's useful if a trinary boolean system is required.
Boolean? married = null;
if (married == true)
{
Console.WriteLine("married = true");
}
else if (married == false)
{
Console.WriteLine("married = false");
}
else
{
Console.WriteLine("married = null");
}
The code above outputs married = null
That's all for now. Tune in again!
No comments:
Post a Comment