Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1.     unsafe class Program{
  2.         static void Main(string[] args){
  3.             int num = 10;
  4.             Console.WriteLine(num); //10
  5.  
  6.             shit1(num);
  7.             Console.WriteLine(num); //10
  8.  
  9.             shit2(ref num);
  10.             Console.WriteLine(num); //20
  11.  
  12.             shit3(&num);
  13.             Console.WriteLine(num); //30
  14.  
  15.             string sajt = "sajt";
  16.             Console.WriteLine(sajt); //sajt
  17.  
  18.             shit4(sajt);
  19.             Console.WriteLine(sajt); //sajt
  20.  
  21.             shit5(ref sajt);
  22.             Console.WriteLine(sajt); //keksz
  23.         }
  24.  
  25.         public static void shit1(int number){
  26.             number = 20;
  27.         }
  28.  
  29.         public static void shit2(ref int number){
  30.             number = 20;
  31.         }
  32.  
  33.         public static void shit3(int* sajt){
  34.             *sajt = 30;
  35.         }
  36.  
  37.         public static void shit4(string sajt){
  38.             sajt = "keksz";
  39.         }
  40.  
  41.         public static void shit5(ref string sajt){
  42.             sajt = "keksz";
  43.         }
  44.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement