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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -