clearz Posted November 28, 2003 Posted November 28, 2003 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 Quote
Moderators Robby Posted November 28, 2003 Moderators Posted November 28, 2003 Is this a rhetorical question, are you just making an observation? Quote Visit...Bassic Software
Leaders Squirm Posted November 29, 2003 Leaders Posted November 29, 2003 It doesn't explain why such conventions are used, but it does lay down the rules for good practice: http://msdn.microsoft.com/library/default.asp?url=/library/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. Quote Search the forums | Still IRCing | Be nice
clearz Posted November 29, 2003 Author Posted November 29, 2003 No it is not a rhetorical question. It is not just java that uses the lower case convention UML uses it also. Quote
tdurden Posted December 1, 2003 Posted December 1, 2003 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 Quote
iebidan Posted December 1, 2003 Posted December 1, 2003 Nope, you can't do it in C# Quote Fat kids are harder to kidnap
Moderators Robby Posted December 1, 2003 Moderators Posted December 1, 2003 CStr, MsgBox and all those other VB6 string functions have been replaced in .NET with bigger and better ones. Quote Visit...Bassic Software
tdurden Posted December 2, 2003 Posted December 2, 2003 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. Quote
bri189a Posted December 2, 2003 Posted December 2, 2003 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. Quote
Moderators Robby Posted December 2, 2003 Moderators Posted December 2, 2003 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. Quote Visit...Bassic Software
tdurden Posted December 2, 2003 Posted December 2, 2003 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.:( Quote
tdurden Posted December 2, 2003 Posted December 2, 2003 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? Quote
*Gurus* Derek Stone Posted December 2, 2003 *Gurus* Posted December 2, 2003 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. Quote Posting Guidelines
tdurden Posted December 2, 2003 Posted December 2, 2003 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. Quote
Mike_R Posted December 2, 2003 Posted December 2, 2003 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 Quote Posting Guidelines Avatar by Lebb
Rick_Fla Posted December 2, 2003 Posted December 2, 2003 MessageBox() replaces MsgBox() Quote "Nobody knows what I do until I stop doing it."
Mike_R Posted December 2, 2003 Posted December 2, 2003 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 Quote Posting Guidelines Avatar by Lebb
Mike_R Posted December 2, 2003 Posted December 2, 2003 And is CType() that which replaces CStr(), or is there something else I should be aware of? Thanks in advance... -- Mike Quote Posting Guidelines Avatar by Lebb
Rick_Fla Posted December 2, 2003 Posted December 2, 2003 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 :) Quote "Nobody knows what I do until I stop doing it."
*Experts* Bucky Posted December 2, 2003 *Experts* Posted December 2, 2003 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(). Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.