Arity is the number of arguments that a method takes.
For example
void MyMethod(int i1, int i2)
has an arity of 2, since it takes 2 arguments.
In C# the arity is marked with `
"So why is this important?", you might ask.
Well it isn't. Until you deal with reflection. :)
A while ago I had to create some code using CodeDOM and i was getting a few errors that the ` in code isn't correct
when i tried to compile the code.
Here's an example of how arity is shown using reflection:
List<string> list = new List<string>();
Console.WriteLine(list.GetType().ToString());
// output: System.Collections.Generic.List`1[System.String]
Dictionary<int, string> dict = new Dictionary<int, string>();
Console.WriteLine(dict.GetType().ToString());
// output: System.Collections.Generic.Dictionary`2[System.Int32,System.String]
You can see that the ` is used to tell us how many arguments a generic type uses.