Click here to Skip to main content
13,732,381 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Sander Rossel19-Mar-18 21:28
professionalSander Rossel19-Mar-18 21:28 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Sentenryu29-Mar-18 1:41
memberSentenryu29-Mar-18 1:41 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Walt Fair, Jr.12-Apr-18 9:44
professionalWalt Fair, Jr.12-Apr-18 9:44 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Bernhard Hiller18-Mar-18 22:42
memberBernhard Hiller18-Mar-18 22:42 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 2:31
mvpraddevus19-Mar-18 2:31 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Super Lloyd19-Mar-18 2:29
memberSuper Lloyd19-Mar-18 2:29 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 2:32
mvpraddevus19-Mar-18 2:32 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Super Lloyd19-Mar-18 2:42
memberSuper Lloyd19-Mar-18 2:42 
it's cute, you are learning new stuff. that is good. Smile | :)

The Tee code sample is contrived though, simply because it can be rewritten much more mean and lean like
var value = ...;
action(value)
// ... continue ... 

it was, to put it bluntly, grossly over engineered, and should not be done in real work project! Blush | :O

However here is something like the given Tee function that could be more useful
public static class Helper
{
  public static IEnumerable<T> Tee(this IEnumerable<T> enumerable, Action<T> action)
  {
     foreach (var e in enumerable)
     {
       action(e);
       yield return e;
     }
  }
}
A new .NET Serializer
All in one Menu-Ribbon Bar
Taking over the world since 1371!


modified 19-Mar-18 8:58am.

GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Richard Deeming19-Mar-18 2:44
mvpRichard Deeming19-Mar-18 2:44 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Super Lloyd19-Mar-18 2:48
memberSuper Lloyd19-Mar-18 2:48 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 3:56
mvpraddevus19-Mar-18 3:56 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Eddy Vluggen19-Mar-18 4:09
professionalEddy Vluggen19-Mar-18 4:09 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 4:13
mvpraddevus19-Mar-18 4:13 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Eddy Vluggen19-Mar-18 4:18
professionalEddy Vluggen19-Mar-18 4:18 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 5:46
mvpraddevus19-Mar-18 5:46 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Eddy Vluggen19-Mar-18 6:16
professionalEddy Vluggen19-Mar-18 6:16 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 7:23
mvpraddevus19-Mar-18 7:23 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Eddy Vluggen19-Mar-18 8:03
professionalEddy Vluggen19-Mar-18 8:03 
GeneralOFFTOPIC Pin
Nelek19-Mar-18 7:00
protectorNelek19-Mar-18 7:00 
GeneralRe: OFFTOPIC Pin
raddevus19-Mar-18 7:21
mvpraddevus19-Mar-18 7:21 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Sander Rossel20-Mar-18 5:52
professionalSander Rossel20-Mar-18 5:52 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus20-Mar-18 7:24
mvpraddevus20-Mar-18 7:24 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Richard Deeming20-Mar-18 7:32
mvpRichard Deeming20-Mar-18 7:32 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus20-Mar-18 8:24
mvpraddevus20-Mar-18 8:24 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Sander Rossel21-Mar-18 1:38
professionalSander Rossel21-Mar-18 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web06-2016 | 2.8.180920.1 | Last Updated 16 Oct 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid