R4R
Right Place For Right Person TM

R4R C# C# Examples Parameter Modifier

C# Examples             

Index 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

Parameter Modifiers example in C#

         



/*Parameter Modifiers example in C#:-
params:-To pass any number of parameter
*/
using System;
public class MyClass 
{

   public static void a(params int[] list) 
   {
      for ( int i = 0 ; i < list.Length ; i++ )
         Console.WriteLine(list[i]);
     
   }

   public static void b(params object[] list) 
   {
      for ( int i = 0 ; i < list.Length ; i++ )
         Console.WriteLine(list[i]);
      Console.WriteLine();
   }
 

   public static void Main() 
   {
     a(1, 2,888,99, 3,44,55,66);
     b(1, 'a', "test"); 
     int[] myarray = new int[3] {10,11,12};
     a(myarray);
    
   }
}

 Download Source Code

Index 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40


Tolal:0 Click:
Show All Comments

Post Your Comments

Your Name:

Your Email ID :
Comments :
URL
  =* Enter SUM

[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]
[an error occurred while processing this directive]