1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

use of param keyword in c#

Discussion in 'C#' started by Ritu_Pruthi, Apr 19, 2011.

  1. Ritu_Pruthi

    Ritu_Pruthi New Member

    Code:
    //file name wrappedint
    namespace Parameters
    {
            class WrappedInt
            {
            public int Number;
            }
    }
    
    //file name program
    namespace Parameters
    {
        class Program
        {
            static void Entrance()
            {
                int i = 0;
                Console.WriteLine(i);
                Pass.Value(i);
                Console.WriteLine(i);
                WrappedInt wi = new WrappedInt();
                Console.WriteLine(wi.Number);
                Pass.Reference(wi);
                Console.WriteLine(wi.Number);
            }
            static void Main(string[] args)
            {
                try
                {
                    Entrance();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
    }using System;
    
    //file name pass
    namespace Parameters
    {
            class Pass
            {
            public static void Value(int param)
            {
                param = 42;
            }
            public static void Reference (WrappedInt param)
            {
                param.Number = 42;
            }
            }
    }
    can anyone tell me the output of this program and how it is working ?:nonod:
     
    Last edited by a moderator: Apr 20, 2011
  2. shabbir

    shabbir Administrator Staff Member

    You should be asking this question to the person who has written this program.
     

Share This Page