Q:

Why am I getting these out parameter errors in C#?

I am new to C#. I've tried this with out parameter in C#   
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class First
{
    public void fun(out int m)
    {
        m *= 10;
        Console.WriteLine("value of m = " + m);
    }
}

class Program
{
    static void Main(string[] args)
    {
        First f = new First();
        int x = 30;
        f.fun(out x);
    }
}

but i get some errors like "Use of unassigned out parameter 'm'" and
The out parameter 'm' must be assigned to before control leaves the current method. 
So what is the meaning of these errors and why it is compulsory to assign 'm' when i'm already assigned a value to x.

A:

ref means that you are passing a reference to the variable that has been declared and initialized, before calling the method, and that the method can modify the value of that variable.  
out means you are passing a reference to the variable that has been declared but not yet initialized, before calling the method, and that the method must initialize or set it's value before returning.  

A:

You're getting an error because a variable sent to a method as an out parameter does not have to be initialized before the method call. The following is 100% correct code:
class Program
{
    static void Main(string[] args)
    {
        First f = new First();
        int x;
        f.fun(out x);
    }
}

Looks like you're looking for ref instead of out here:
class First
{
    public void fun(ref int m)
    {
        m *= 10;
        Console.WriteLine("value of m = " + m);
    }
}

class Program
{
    static void Main(string[] args)
    {
        First f = new First();
        int x = 30;
        f.fun(ref x);
    }
}

