Quick syntax question

  • Thread starter Thread starter Blip
  • Start date Start date
B

Blip

In a test function's return variables I see this:

public void foo(int _Bar1_, string _Bar2, string _Bar3_, short _bar4)
etc...

What do the underscores signify if anything? For what it's worth, the
variables w/ two underscores are both enum elements.

Thanks
 
In a test function's return variables I see this:

public void foo(int _Bar1_, string _Bar2, string _Bar3_, short _bar4)
etc...

What do the underscores signify if anything? For what it's worth, the
variables w/ two underscores are both enum elements.

They signify that whoever created the method doesn't believe in making
method declarations easy to read/understand...

Using underscores for private instance variables is reasonably common,
but parameter names should really just be straight camel-cased.

Jon
 
In a test function's return variables I see this:

public void foo(int _Bar1_, string _Bar2, string _Bar3_, short _bar4)
etc...

What do the underscores signify if anything? For what it's worth, the
variables w/ two underscores are both enum elements.

The don't signify anything special. If they signify anything, you
would have to ask the original programmer what he/she meant by using
the underscores in the name.

FWIW, I used to like to use underscores to identify private variables
in a class that would be exposed by public properties. But with C#,
all you need to do is change the case.
 
Blip,

They don't really indicate anything. It used to be that underscores
were used as a convention for hidden/private members, but that convention
doesn't apply to .NET parameters (or at least, I haven't seen it applied to
them).

Where did you get this code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top