Wednesday 27 July 2016

C Sharp Function Overload

C# Function Overload

class test
{
        public void sum()
        {
            int a, b, c;
            Console.Write("Enter first number>> ");
            a = int.Parse(Console.ReadLine());
            Console.Write("Enter second number>> ");
            b = int.Parse(Console.ReadLine());
            c=a+b;
            Console.Write("\nA={0}\nB={1}\nSum={2}",a,b,c);
        }

C Sharp This pointer tutorial

C# This pointer tutorial

class test
    {
        int x, y;
        public test(int x, int y)
        {
            this.x = x;
            this.y = y;

C Sharp Static Class Tutorial

C# Static Class Tutorial

class testmath
    {
        public static int sum(int a, int b)
        {
            return a + b;
        }
        public static Boolean prime(int a)
        {
            int b;
            for (b = 2; b < a; b++)
            {
                if (a % b == 0)
                    break;

C Sharp Delegate

C# Delegate 

A delegate is a simple class that is used to point to methods with a specific signature, becoming essentially a type-safe function pointer.
If you have a C++ background then  thinking of them as function pointers is helpful
A delegate can be seen as a placeholder for a/some method(s).
By defining a delegate, you are saying to the user of your class 
"Please feel free to put any method that match this signature here and it will be called each time my delegate is called".
class Program
    {
        delegate int mathop(int n, int m);//funtion pointer
        public  static int sum(int a, int b)
        {
            return a + b;
        }
        public  static int multi(int a, int b)
        {
            return a * b;
        }