Posted on 01 June 2010, 14:33, by Ola, under
C#,
LINQ.
This is another awesome feature in LINQ to SQL that i always forget about. Sometimes you have an array of strings or any other type and want to query the database for all values that have one of the values in the array. string platform = “windows|linux”; string[] platformList = platform.Split(‘|’); itemQuery = from m [...]
Posted on 20 April 2010, 14:29, by Ola, under
C#.
For some reason I always forget that you do not do .Join on your actual string array. So i might as well write it down here so i never forget about this again. string mycommalist = string.Join(“,”, alternatives.Select(x=>x.Item.Name).ToArray())
Posted on 07 November 2009, 16:35, by Ola, under
C#.
Sometimes you want to convert arrays back and forth. This is to nice extension methods to convert a int array into a string array and vice versa. public static class ExtensionMethods { public static string[] ToStringArray(this int[] intArray) { return Array.ConvertAll<int, string>(intArray, delegate(int intParameter) { return intParameter.ToString(); }); } public static int[] ToIntArray(this string[] strArray) [...]