A swap function is a common thing to write: a function that swaps two values. To do this, go to Solution Explorer, right-click on the name of the website, select Add, and then click on Class. Name the class GenMethods to keep it simple, and then click on OK. When the Visual Studio message comes up, click on Yes.
When the GenMethods file comes up, the only thing that you should leave there is using System. We don't need the constructor for this class, so get rid of that. Then, within the body of GenMethods, define the following between the set of curly braces below the public class GenMethods line:
public static void Swap<T>(ref T x, ref T y)
This will act at the class level: you don't have to make an object of the GenMethods type. In a sense, the only thing that is new here is the fact that this is a Swap<T> function, which means that...