Sunday, August 2, 2009

What is a method in C#.NET?

An example would be great.

What is a method in C#.NET?
A method (not just in C#, but also in other object oriented languages) is a function that is part of a class. It is for this reason sometimes also referred to as a member function.





class Test


{


    public int Add(int x, int y)


    {


        return x + y;


    }


}





In this example, Add() is a method of the Test class.
Reply:method is function that it can capsuled your code and run some related code in it.for example in windows application when you click any button it execute a method that do something(running some code)

avender

No comments:

Post a Comment