Methods are functions which are members of a class or struct.
Some languages (such as C++) allow you to create 'stand alone' (or global) functions as well as methods. However, this isn't possible in C# - all functions must be members of a class or struct.
Hi Mohit, Not only in C#, Methods are there in every OOP language. I would suggest you to study OOPS first and then you can study Methods here : http://msdn.microsoft.com/en-IN/library/ms173114.aspx. You can get a brief idea about OOPS here : http://en.wikipedia.org/wiki/Object-oriented_programming.
Jignesh TrivediPosted Jul 21, 2014, 7:19 AM
Method is code block that contains series of Statement. It combines related code together and makes program easier.
Please refer
http://www.csharp-station.com/Tutorial/CSharp/lesson05
http://www.c-sharpcorner.com/UploadFile/myoussef/CSharpMethodsP_111152005003025AM/CSharpMethodsP_1.aspx
hope this will help you.
VulpesPosted Jul 21, 2014, 5:50 AM
Some languages (such as C++) allow you to create 'stand alone' (or global) functions as well as methods. However, this isn't possible in C# - all functions must be members of a class or struct.
Anupam SinghPosted Jul 21, 2014, 3:12 AM
Not only in C#, Methods are there in every OOP language. I would suggest you to study OOPS first and then you can study Methods here : http://msdn.microsoft.com/en-IN/library/ms173114.aspx.
You can get a brief idea about OOPS here : http://en.wikipedia.org/wiki/Object-oriented_programming.
All the best.