c# - this List<string> ListName as a parameter? -
what mean when have list parameter method?
public static void killzombies(this list<zombie> zombiestokill, int numberofbullets) { ... }
that mean method extension method:
the code calling method might little confusing:
var zombies = new list<zombie>(); zombies.killzombies(15);
in reality, kind of syntactic sugar equivalent to:
public static void killzombies(list<zombie> zombiestokill, int numberofbullets) { // code here }
with calling code looking like:
var zombies = new list<zombie>(); killzombies(zombies, 15);
Comments
Post a Comment