using System.Runtime.InteropServices.Marshalling; namespace ConsoleApp19 { internal class Program { static void Vymen(ref T x, ref T y) { T pom = x; x = y; y = pom; } static void Usporadej(ref T a, ref T b) where T : IComparable { if (a.CompareTo(b) == +1) { T pom = a; a = b; b = pom; } } static void Main(string[] args) { Console.WriteLine(Resource1.Pozdrav); //TODO nejaky lepsi priklad int a = 111; int b = 22; string c = "abc"; Console.WriteLine($"a={a} b={b}"); Usporadej(ref a, ref b); //Vymen(ref a, ref c); Console.WriteLine($"a={a} b={b}"); string sa = "jedenact"; string sb = "dvaadvacet"; Console.WriteLine($"sa={sa} sb={sb}"); Vymen(ref sa, ref sb); Console.WriteLine($"sa={sa} sb={sb}"); double da = 1.1; double db = 2.2; Console.WriteLine($"da={da} db={db}"); Vymen(ref da, ref db); Console.WriteLine($"da={da} db={db}"); } } }