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 HobbsPosted Dec 9, 2010, 12:24 PM
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.
CrishPosted Dec 10, 2010, 5:56 AM
To get more detail about method beginner just go through this below link.
http://richardbowles.tripod.com/java/guide/methods/methods.htm
John BurnsPosted Dec 10, 2010, 2:24 AM
Santhosh NPosted Dec 9, 2010, 4:45 AM
Subhendu DePosted Dec 9, 2010, 3:21 AM
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.....