Example using Call By Out parameter in C#

public class OPExample
{
    public void Addme(int x, int y, out int result)
    {
        result = x + y;
    }
 
    static void Main(string[] args)
    {
        OPExample obj = new OPExample();
        int a = 1, b = 2, result;
        obj.Addme(a, b, out result);
        Console.WriteLine("Out Parameter Result is =" + result);
        Console.ReadKey();
    }
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.