//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class NewClass
{
public int i=0;
}
public class Program
{
public static void Main(string[] args)
{
//Your code goes here
Console.WriteLine("Hello, world!");
int a=6;
Add(a);
Console.WriteLine(a);// Print 6
a=8;
AddRef(ref a);
Console.WriteLine("Ref "+ a);//Print 9
int b;
AddOut(out b);
Console.WriteLine("Out "+ b);// Print 10
NewClass obj = new NewClass();
obj.i=10;
AddClassObject(obj);
Console.WriteLine("New Class Value "+ obj.i);// Print 10
}
private static void AddClassObject(NewClass obj)
{
obj.i=19;
Console.WriteLine("Class Value "+ obj.i);// Print 10
}
private static void Add(int a)
{
a=10;
Console.WriteLine(a);// Print 10
}
private static void AddRef(ref int a)
{
a=9;
Console.WriteLine(a);//Print 9
}
private static int AddOut(out int b)
{
string s="10s";
int i;
if(int.TryParse(s,out i))
Console.WriteLine("Int i value " + i);
b=10;
Console.WriteLine(b);
return 80;
}
}
}
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class NewClass
{
public int i=0;
}
public class Program
{
public static void Main(string[] args)
{
//Your code goes here
Console.WriteLine("Hello, world!");
int a=6;
Add(a);
Console.WriteLine(a);// Print 6
a=8;
AddRef(ref a);
Console.WriteLine("Ref "+ a);//Print 9
int b;
AddOut(out b);
Console.WriteLine("Out "+ b);// Print 10
NewClass obj = new NewClass();
obj.i=10;
AddClassObject(obj);
Console.WriteLine("New Class Value "+ obj.i);// Print 10
}
private static void AddClassObject(NewClass obj)
{
obj.i=19;
Console.WriteLine("Class Value "+ obj.i);// Print 10
}
private static void Add(int a)
{
a=10;
Console.WriteLine(a);// Print 10
}
private static void AddRef(ref int a)
{
a=9;
Console.WriteLine(a);//Print 9
}
private static int AddOut(out int b)
{
string s="10s";
int i;
if(int.TryParse(s,out i))
Console.WriteLine("Int i value " + i);
b=10;
Console.WriteLine(b);
return 80;
}
}
}
No comments:
Post a Comment