|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Anonymous methodI made a vaery simple Join operation from an object[] (here I call it myArray) to a string[] using a Converter<Tinput, TOutput> protected void Button1_Click(object sender, EventArgs e) { Label1.Text = String.Join("|", Array.ConvertAll<object, string>(myArray, new Converter<object,string>(CObj))); } protected static string CObj(object item) { return item.ToString(); } How can I do the same operation using an anonymous method instead of using the static CObj function? Can you help me with the sintax? Thanks!!!! >How can I do the same operation using an anonymous method instead of Label1.Text = String.Join("|", Array.ConvertAll<object,>using >the static CObj function? >Can you help me with the sintax? string>(myArray, delegate(object item) { return item.ToString(); } )); Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
Other interesting topics
Simple problem: Why does this cause a massive memory leak?
how to control UDP sending Speed? How to handle this exception? What is WPF equivalent of the open folder dialog of WindowsForms? BLOB problem Loading from GAC without all information Using Generics vs Passing System.Type as argument? .NET Speech Recognition handle leak - hotfix availability intercepting the CLR |
|||||||||||||||||||||||