Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Leaders
Posted

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.

Posted
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
Posted
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.

Posted
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.
  • Moderators
Posted

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.

Visit...Bassic Software
Posted
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.:(

Posted
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?

  • *Gurus*
Posted
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.

Posted
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.

Posted

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

Posting Guidelines

 

Avatar by Lebb

Posted

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 :)

"Nobody knows what I do until I stop doing it."
  • *Experts*
Posted
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().

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...