using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SampApp { class Sample { static int i; static Sample() { i = 10; Console.WriteLine("In Static Constructor"); } public Sample() { Console.WriteLine("In Instance Constructor"); } public static void Main() { Sample s = new Sample(); } } }
class ClsContainer { public partial class Nested { void App1() { } } public partial class Nested { void App2() { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Nested { class ClsContainer { string outerClsVariable = "This is outer class variable"; public class InnerClass { ClsContainer Obj = new ClsContainer(); string innerClsVariable = "This is inner class variable"; public InnerClass() { Console.WriteLine(Obj.outerClsVariable); Console.WriteLine(this.innerClsVariable); } } } class Exec { public static void Main() { ClsContainer.InnerClass nestedClsObj = new ClsContainer.InnerClass(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Sample { class Program { public static void Main() { int N1 = 10; int N2 = 20; //N1 and N2 are method arguments int Total = Sum(N1, N2); Console.WriteLine(Total); } //FNum and SNum are method parameters public static int Sum(int FNum, int SNum) { int Sum = FNum + SNum; return Sum; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Sample { class Program { public static void Main() { int a = 10; Console.WriteLine("Value of a before passing to the method = " + a); Function(ref a); Console.WriteLine("Value of a after passing to the method by reference= " + a); } public static void Function(ref int Num) { Num = Num + 5; } } }
class Sample { ~Sample() { ……. ……. } }
installutil -i ServiceName.exe
installutil -u ServiceName.exe