'base' as a function parameter name in C# -


i following microsoft's naming guidelines, , using camelcase in function parameter naming. suppose use signature

public string writenumberinbase (int number, int base) 

in method , compiler complaining parameter name because 'base' reserved keyword... there way can 'base' accepted parameter name?

try this:

public string writenumberinbase (int number, int @base) //                                               ^ //                             @ sign used "escape" keywords 

(as side note, in vb.net same putting keyword or reserved word in square brackets, e.g. [mybase].)

or alternatively, call parameter radix instead of base.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -