dinsdag 7 februari 2012

Powerfull extension method C# 'In'

How easy can it be?

public static bool In(this string search, params string[] list){ return list.Contains(search); }

Now you can use

string a;

a = functionB();

if( a.In( "Yes", "No" ) )

{

}


 

Geen opmerkingen: