static void Main(string[] args) { SampleClass sampleObject = new SampleClass(); sampleObject.Sample = "Sample String"; sampleObject.sampleMethod(1); SampleGeneric <string> asdf = new SampleGeneric <string>(); asdf.Field = "Sample string"; Container.Nested nestedInstance = new Container.Nested(); }
/// <summary> /// Create a generic method /// </summary> public static void ScenarioOne() { var a = 10; var b = 20; Console.WriteLine("Value of a should be A: " + a); Console.WriteLine("Value of b should be B: " + b); SampleGeneric.Swap <int>(ref a, ref b); System.Console.WriteLine("----------"); Console.WriteLine("Value of a should be A: " + a); Console.WriteLine("Value of b should be B: " + b); // Keep the console open in debug mode. Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
/*------------------------ FIELDS REGION ------------------------*/ /*------------------------ METHODS REGION ------------------------*/ public void Main() { SampleGeneric <Person> sampleGeneric = new SampleGeneric <Person>( "Abc", new string[] { "Cde" } ); }