Tag Archives: msdn

Generating a random color in C#

Always wanted to have your own random color generator in C#? This snippet shows you how to do it.

Posted in C# | Also tagged , , , , , , , , | 1 Comment

Properties in C#

Properties in C# can be used to set or get the value of an attribute. Suppose you have a class called Person which has the attributes name and age. class Person { String name; int age; public Person(String name, int age){ this.name = name; this.age = age; } } The attributes of the Person class [...]

Posted in C# | Also tagged , , , , , | Leave a comment

Printing to the console in C#

The Console.WriteLine method can be used to print a line to the console. public void Foo(){ Console.WriteLine(“Bar”); }

Posted in C# | Also tagged , , , , , | Leave a comment