Click here to Skip to main content
11,437,397 members (35,452 online)

Articles by cechode (Tip/Tricks: 7)

Tip/Tricks: 7

RSS Feed
No articles have been posted.
No blogs have been submitted.

Average tips rating: 4.10

.NET Framework
General
Posted: 10 Oct 2011   Updated: 10 Oct 2011   Views: 1,840   Rating: 1.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      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;}
Algorithms & Recipes
General
Posted: 10 Dec 2010   Updated: 19 Dec 2010   Views: 1,280   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      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[]...
Programming Tips
General
Posted: 12 Jan 2011   Updated: 13 Jan 2011   Views: 2,600   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
I ended up adding one for a Lazy Property: propLazy ...
Posted: 9 Feb 2011   Updated: 15 Feb 2011   Views: 2,520   Rating: 4.86/5    Votes: 4   Popularity: 2.81
Licence: The Code Project Open License (CPOL)      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...
Posted: 14 Feb 2011   Updated: 17 Feb 2011   Views: 1,090   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      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++) { ...
Posted: 28 Mar 2011   Updated: 29 Mar 2011   Views: 1,490   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      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,...
Posted: 8 Apr 2011   Updated: 8 Apr 2011   Views: 6,380   Rating: 4.67/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      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...
No reference articles have been posted.

cechode

United States United States
No Biography provided


Advertise | Privacy | Mobile
Web01 | 2.8.150428.2 | Last Updated 6 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid