This List <string> ListName as parameter?
2 answers
This would mean that the Method Extension Method :
The code calling the method may look a bit confusing:
var zombies = new List<Zombie>();
zombies.KillZombies(15);
In fact, it is a kind of syntactic sugar that is equivalent to:
public static void KillZombies(List<Zombie> zombiesToKill,
int numberOfBullets)
{
// Code here
}
With calling code similar to:
var zombies = new List<Zombie>();
KillZombies(zombies, 15);
+8
This is an extension method .
In this case, the extension List<Zombie>. You would call it this way:
listOfZombies.KillZombies(numberOfBullets);
If the type listOfZombiesis equal List<Zombie>, a numberOfBulletsis an integer.
+1