WPF |
12 Jan 2011
Updated: 13 Jan 2011
Rating: 5.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 8,860
Bookmarked: 1
Downloaded: 0
I ended up adding one for a Lazy Property: propLazy ...
|
C# |
10 Oct 2011
Updated: 10 Oct 2011
Rating: 1.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 6,260
Bookmarked: 0
Downloaded: 0
public static IEnumerable randomize(this IEnumerable source) { var y = (from s in source select new { n = myrandomeImpl.Next(), v = s }).OrderBy(f => f.n); foreach (var item in y) yield return item.v;}
|
|
10 Dec 2010
Updated: 19 Dec 2010
Rating: 5.00/5
Votes: 2
Popularity: 1.51
Licence: CPOL
Views: 5,051
Bookmarked: 1
Downloaded: 0
I had the same problem, but Contains was a disaster waiting to happen. :(I ended up creating something like: //Lists is a list of 4 lists ( Added, Changed, Deleted , Unchanged )public static Lists Diff(List listA, List listB, IComparer PrimaryCompare, IComparer[]...
|
|
9 Feb 2011
Updated: 15 Feb 2011
Rating: 4.86/5
Votes: 4
Popularity: 2.92
Licence: CPOL
Views: 9,051
Bookmarked: 2
Downloaded: 0
This does the same. (I'm not sure it's better, but I'm a fan of this style) :)static string toggle(string t){ return (from c in t select new string(Char.IsLower(c) ? Char.ToUpper(c) : Char.ToLower(c), 1)).Aggregate((a, b) => a += b);}much better performance than stringbuilder...
|
|
14 Feb 2011
Updated: 17 Feb 2011
Rating: 0.00/5
Votes: 0
Popularity: 0.00
Licence: CPOL
Views: 4,050
Bookmarked: 2
Downloaded: 0
Using the .NET profiler, I compared ToggleCaseByRobertToggleCaseByJohnand my new one given below: static string ToggleCaseByCeChode(string s) { char[] chars = s.ToCharArray(); for (int i = 0; i < chars.Length; i++) { ...
|
Visual Basic |
28 Mar 2011
Updated: 29 Mar 2011
Rating: 0.00/5
Votes: 0
Popularity: 0.00
Licence: CPOL
Views: 5,160
Bookmarked: 1
Downloaded: 0
Sorry, but could not resist :)Being that we we started with select case (in the launge), I felt that this was missing both the initial condition and the action to perform for the case that got hit.So given this:static Action SelectCase(T conditionValue, List<System.Tuple<Func<T,...
|
ASP.NET |
8 Apr 2011
Updated: 8 Apr 2011
Rating: 4.67/5
Votes: 3
Popularity: 2.23
Licence: CPOL
Views: 21,291
Bookmarked: 2
Downloaded: 0
Saw this a while back; it's simpler (dirty and wrong but... ):public static T Get(Func getDelegate, bool DefaultTOnNull = false, T defaultVal = null) where T : class{ T result = null; try { result = getDelegate(); } catch...
|