c# 4.0 - C# 4.0 Anonymous Functions -
how do following shown in javascript in c# 4.0:
var output = dosomething(variable, function() { // anonymous function code });
i'm sure i've seen somewhere before cannot find examples.
you'll want in lambda expressions though it's not quite javascript because c# works quite bit differently. may want check out delegates.
example code:
namespace test { class tests { delegate string mydelegate(); public void main(string[] args) { var output = dosomething("test1", () => { return "test2";} ); } public string dosomething(string test, mydelegate d) { return test + d(); } } }
Comments
Post a Comment