Hey guys,
this is my first post, i have some experience programming but in VB.NET.
i have some confusion when it comes to Methods in C#
the word 'Static' confuses me and then i see methods without the word Static ?? and then there are Methods that start with Char ect. It seems way more complex than VB.NET
I have a rough idea that the word static may be methods that return values, almost like Functions in VB.NET and the ones without the static act like subs?
Alos, in you're opinion; i know that there are no powers to learn c# over vb since they are both compliled into MSIL but what would be the most beneficial one to learn looking towards the future?
thanks
John
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Dec 9, 2010, 7:24 AM EST
A method definition is prefixed with the return type; the return type is fundamentally the same as the return type in a VB function that is, in VB, specified after "As" in the function. If nothing is returned then "void" is used in C# as the return type.
The return value of a static method can be anything that a non-static method can return.
Subhendu DeRank #1,108 · 1.7K reputationPosted Dec 8, 2010, 10:21 PM EST
public class Test
{
public static void TestMethod(){};
}
You can call this by Test.TestMethod(). There is nothing related to return type with static. Static keyword enables CLR to access the methods without instatiating object of the defining class.
C#/VB.NET both language has their own merits/demerits. So try to learn one and then you can work on other after 2/3 years of coding.
Thanks.....
Santhosh NRank #4,788 · 325 reputationPosted Dec 8, 2010, 11:45 PM EST
John Burns116 reputationPosted Dec 9, 2010, 9:24 PM EST
CrishRank #1,487 · 1.1K reputationPosted Dec 10, 2010, 12:56 AM EST
To get more detail about method beginner just go through this below link.
http://richardbowles.tripod.com/java/guide/methods/methods.htm