locked
Very simple C# question regarding variable declarations RRS feed

  • Question

  • Hello,

    I've been away from programming for a year and forgotten a few basics.  One thing I'd like to know is does each variable require its own type declaration or is it implicit if it's on the same line?

    i.e. is

    string strForename, strSurname;

    the same as

    string strForename;
    string strSurname;

    I seem to remember there was a difference but can't quite remember, please let me know.

    many thanks

    Claire
    Monday, July 28, 2008 8:19 AM

Answers

  • yes, it differs nothing.
    we can do like that.
    • Marked as answer by jack 321 Thursday, July 31, 2008 3:42 AM
    Monday, July 28, 2008 8:34 AM
  • Start up Visual Studio, try it out.  It won't byte.
    Hans Passant.
    • Marked as answer by jack 321 Thursday, July 31, 2008 3:43 AM
    Monday, July 28, 2008 6:20 PM

All replies

  • yes, it differs nothing.
    we can do like that.
    • Marked as answer by jack 321 Thursday, July 31, 2008 3:42 AM
    Monday, July 28, 2008 8:34 AM
  • Start up Visual Studio, try it out.  It won't byte.
    Hans Passant.
    • Marked as answer by jack 321 Thursday, July 31, 2008 3:43 AM
    Monday, July 28, 2008 6:20 PM