What does it mean when you have a this List as a parameter to a method?
public static void KillZombies(this List<Zombie> ZombiesToKill, int NumberOfBullets)
{
...
}
That would mean that the method is an Extension Method:
The code calling the method might look a little confusing:
var zombies = new List<Zombie>();
zombies.KillZombies(15);
In reality, this is a kind of syntactic sugar which is equivalent to:
public static void KillZombies(List<Zombie> zombiesToKill,
int numberOfBullets)
{
// Code here
}
With the calling code looking like:
var zombies = new List<Zombie>();
KillZombies(zombies, 15);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With