@parameter

  • Thread starter Thread starter Yin99
  • Start date Start date
Y

Yin99

I have method that takes (int productID) as parameter- was playing
around with VS2005 Class designer which writes it as (int
@productID) . Any Difference? Best Practices?

-Yin
 
Hi,

If the designer writes it like that, well it should work and should be the
expected naming convention.

I do not understand your concern, in T-SQL a variable is denoted with a @
prefix
 
Yin99 said:
I have method that takes (int productID) as parameter- was playing
around with VS2005 Class designer which writes it as (int
@productID) . Any Difference? Best Practices?

@ lets you use keywords as identifiers, eg

Foo (int @string)

Generally it's a good idea to avoid using keywords as parameter names
to start with, but the designer will use @ to make absolutely sure that
it won't cause problems (even if your identifier isn't a keyword
anyway).
 
If the designer writes it like that, well it should work and should be the
expected naming convention.

No - that's certainly *not* the expected naming convention and
shouldn't be either.

It's like saying that because the designer puts

control.Size = new System.Drawing.Size(10, 15);

that that's a good idea too. It's not. The designer doesn't worry about
writing *readable* code, it just worries about writing code which is
guaranteed to have the desired effect without causing any ambiguities,
with the least amount of effort. That "least amount of effort" is
attained by making sure that it *can't* be ambiguous, even if it
wouldn't be even if you just used a short form.
 

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