Why the capital letter

clearz

Newcomer
Joined
Jul 21, 2003
Messages
22
Does anyone know why microsoft decided to start all methods in C# with a capital letter. I thought that C# was made to make it easy for java programmers to migrate to the .Net framework this capital letter thing is seriously annoying especially what going from one language to the other.

Clearz
 
It doesn't explain why such conventions are used, but it does lay down the rules for good practice:
http://msdn.microsoft.com/library/d...y/en-us/vsent7/html/vxconcodingtechniques.asp

Since most names are constructed by concatenating several words, use mixed-case formatting to simplify reading them. In addition, to help distinguish between variables and routines, use Pascal casing (CalculateInvoiceTotal) for routine names where the first letter of each word is capitalized. For variable names, use camel casing (documentFormatType) where the first letter of each word except the first is capitalized.

In my opinion, MS have it right - even before I was using .Net, I hated the camelcasing used on methods in Java.
 
No it is not a rhetorical question. It is not just java that uses the lower case convention UML uses it also.
 
While on the subject of caps and the like... is there a way to turn on the automatic capitalization of keywords ala VB6? Meaning that msgbox becomes MsgBox and cstr becomes CStr. It's no big deal, but I'd gotten used to it in VB6
 
Robby said:
CStr, MsgBox and all those other VB6 string functions have been replaced in .NET with bigger and better ones.

Duuuhhh, I'm aware of that. My question is... how do I get the automatic capitalization to work in VB.NET like it does in VB6?

BTW, I don't believe MsgBox() falls in the category of a string function. Another thing, neither have been replaced as they're still supported.
 
I guess the proper word would be they have been 'downgraded', in other words if they show up in the next version they will probably be marked 'obsolete' if they show up at all.
 
Oh man, all these years I referred to the MsgBox as a string function. Thanks for correcting me.

BUT! If you want to program the .NET way and give up this legacy hold on those methods and functions well why not move into the 21st century and use their replacements that were specifically designed to be optimized in a true object oriented environment. Not to mention the ease of later porting VB.NET code to C#.

Also, who knows how long they'll be supported.
 
bri189a said:
I guess the proper word would be they have been 'downgraded', in other words if they show up in the next version they will probably be marked 'obsolete' if they show up at all.

Quite true! I shudder to think how much code is going to "break" when/if MsgBox() is heaved overboard.:(
 
Robby said:
Oh man, all these years I referred to the MsgBox as a string function. Thanks for correcting me.

BUT! If you want to program the .NET way and give up this legacy hold on those methods and functions well why not move into the 21st century and use their replacements that were specifically designed to be optimized in a true object oriented environment. Not to mention the ease of later porting VB.NET code to C#.

Also, who knows how long they'll be supported.

I was simply using the aforementioned functions as an example, not to say that I use them much anymore 'cept for quick and dirty stuff.

Casting your sarcasm to the side, I don't consider MsgBox() a string function is because it doesn't modify strings, return a string or the like. Depending on how you call it, it simply returns an integer indicating which, if any, button the user clicked. 'nuff said on this subject.

As for my original question... has anyone got any ideas?
 
While on the subject of caps and the like... is there a way to turn on the automatic capitalization of keywords ala VB6? Meaning that msgbox becomes MsgBox and cstr becomes CStr.
The IDE does that by default. Make sure you have the reformatting option turned on under Options | Text Editor | Basic | VB Specific.
 
Derek Stone said:
The IDE does that by default. Make sure you have the reformatting option turned on under Options | Text Editor | Basic | VB Specific.

Bingo! I don't know how I missed it, but that's what I needed, thanks! I seem to remember turning that off. For what reason, I've forgotten.
 
I'm a complete .Net newbie here, so I apolgize for this question...

But what are the newer .Net equivalents for MsgBox() and Cstr()? I guess for Cstr() the new version is CType(), or is there something else as well? And what is the new version of MsgBox()?

Thanks in advance!

-- Mike
 
Oh genius, MORE letters not less. Ugh. Wouldn't

Msg()

Have made more sense?
Oh well... whatcha gunna do??

Thank you very much for the Info though.

:),
Mike
 
And is CType() that which replaces CStr(), or is there something else I should be aware of?

Thanks in advance...

-- Mike
 
From VB Studio's Help File

CType() - Returns the result of explicitly converting an expression to a specified data type, object, structure, class, or interface.


CStr() - Returns an expression that has been converted to a Variant of subtype String.

sorry I can not be of more help, pretty new myself to programming other than Coldfusion :)
 
Mike_R said:
But what are the newer .Net equivalents for MsgBox() and Cstr()? I guess for Cstr() the new version is CType(), or is there something else as well? And what is the new version of MsgBox()?

Lemme clear a few things up here...

Every class in the .NET Framework inherits from the most basic
class of all, the Object. The Object has a ToString() method, so
therefore every class and variable has a ToString() method. You
can use this to get a string value. To convert between other
value types, you use the System.Convert class (Convert.ToInt32(),
Convert.ToString() if you want, etc.),
and you use DirectCast() to cast between objects.

The new version of MsgBox is MessageBox.Show().
 
Back
Top