Click here to Skip to main content
15,879,239 members

Articles by cechode (Tip/Tricks: 7)

Tip/Tricks: 7

RSS Feed

Average article rating:

No articles have been posted.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.10

Desktop Programming
WPF
12 Jan 2011   Updated: 13 Jan 2011   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 8,820     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
I ended up adding one for a Lazy Property: propLazy ...
Programming Languages
C#
10 Oct 2011   Updated: 10 Oct 2011   Rating: 1.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 6,230     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
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,001     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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: 8,871     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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,020     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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,130     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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,...
Web Development
ASP.NET
8 Apr 2011   Updated: 8 Apr 2011   Rating: 4.67/5    Votes: 3   Popularity: 2.23
Licence: CPOL    Views: 21,061     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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...

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.