Skip to content

Handling properties

Agustin Ferrari

Asked Dec 18, 2008, 11:14 PM EST2 answers
Share
LinkedInX

I understand the basics of handling properties from classes declared by yourself using {get, set}.

I would like to know how to handle properties of classes already declared by C#, i.e. System.Console.Foreground.

Could anyone help with an example or two?

Gracias

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    [code]System.Console.Foreground[/code] is the color property for the consoles foreground color. All you should have to do to mingle with it is assign a value to it such as

    [code]
    System.Console.Foreground = Color.Blue;
    [/code]

    or get the value of the foreground color, such as

    [code]
    Color foregroundColor = System.Console.Foreground;
    [/code]
    0
  • 0

    Happy New Year!

    Immediately after posting I got an overwhelming list of vessels to attend thus my delay in comming back. Today, yes, today, I got time to work out this.

    Console.ForegroundColor = ConsoleColor.Red;

    Now I am starting to grasp how it actually works.

    Moreover, I was confused about where to look for. Using the Objects explorer in Visual C# Express 2008 I got things clear. Otherwise I would be still lost. (I am affraid you will hear of me again here.)

    It is not 'one giant leap for mankind" but a good start anyway, eh?

    Gracias for replying.

    0