Click here to Skip to main content
15,887,676 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: WPF ValidationErrors Pin
Bernhard Hiller29-May-15 5:35
Bernhard Hiller29-May-15 5:35 
GeneralRe: WPF ValidationErrors Pin
Eddy Vluggen29-May-15 5:46
professionalEddy Vluggen29-May-15 5:46 
GeneralRe: WPF ValidationErrors Pin
Brisingr Aerowing29-May-15 6:00
professionalBrisingr Aerowing29-May-15 6:00 
GeneralRe: WPF ValidationErrors Pin
Eddy Vluggen29-May-15 5:43
professionalEddy Vluggen29-May-15 5:43 
GeneralRe: WPF ValidationErrors Pin
Richard Deeming29-May-15 6:08
mveRichard Deeming29-May-15 6:08 
GeneralRe: WPF ValidationErrors Pin
Bernhard Hiller31-May-15 23:49
Bernhard Hiller31-May-15 23:49 
GeneralRe: WPF ValidationErrors Pin
Richard Deeming1-Jun-15 1:50
mveRichard Deeming1-Jun-15 1:50 
GeneralCode Puzzle Pin
Sascha Lefèvre13-May-15 15:24
professionalSascha Lefèvre13-May-15 15:24 
How many compiler errors, potential NullReferenceExceptions, StackOverflowExceptions and whatnot can you spot in this presumably review-ready class?

And the million dollar question: Can you guess the intended purpose?

C#
public class QueryContainer
{
    private static List<QueryContainer> Container;
    private static QueryContainer instance;

    public static QueryContainer Instance
    {
        get
        {
            if (Instance == null)
                instance = new QueryContainer();

            return instance;
        }
    }

    public int _searchID;

    public int ID { get { return _id; } }

    public string Query
    {
        get { return Container.Find(instance => instance._id == _searchID).Query; }
        set { Container.Query = value; _id =+ 1; }
    }

    private int _id;
    private string _query;

    private QueryContainer()
    { }
}

If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

GeneralRe: Code Puzzle Pin
PIEBALDconsult13-May-15 15:32
mvePIEBALDconsult13-May-15 15:32 
GeneralRe: Code Puzzle Pin
Brisingr Aerowing13-May-15 15:33
professionalBrisingr Aerowing13-May-15 15:33 
GeneralRe: Code Puzzle Pin
Sascha Lefèvre15-May-15 4:26
professionalSascha Lefèvre15-May-15 4:26 
GeneralRe: Code Puzzle Pin
Brisingr Aerowing13-May-15 15:33
professionalBrisingr Aerowing13-May-15 15:33 
GeneralRe: Code Puzzle Pin
Suvabrata Roy13-May-15 21:28
professionalSuvabrata Roy13-May-15 21:28 
GeneralRe: Code Puzzle Pin
Agent__00713-May-15 21:54
professionalAgent__00713-May-15 21:54 
GeneralRe: Code Puzzle Pin
Richard Deeming14-May-15 1:19
mveRichard Deeming14-May-15 1:19 
GeneralRe: Code Puzzle Pin
Agent__00714-May-15 1:46
professionalAgent__00714-May-15 1:46 
GeneralRe: Code Puzzle Pin
Smart K813-May-15 23:26
professionalSmart K813-May-15 23:26 
GeneralRe: Code Puzzle Pin
Power Puff Boy15-May-15 2:04
Power Puff Boy15-May-15 2:04 
GeneralRe: Code Puzzle Pin
Freak3015-May-15 2:11
Freak3015-May-15 2:11 
GeneralRe: Code Puzzle Pin
Richard Deeming15-May-15 3:59
mveRichard Deeming15-May-15 3:59 
GeneralRe: Code Puzzle Pin
Brisingr Aerowing15-May-15 4:02
professionalBrisingr Aerowing15-May-15 4:02 
GeneralRe: Code Puzzle Pin
Sascha Lefèvre15-May-15 4:12
professionalSascha Lefèvre15-May-15 4:12 
GeneralSOLUTION Pin
Sascha Lefèvre15-May-15 4:22
professionalSascha Lefèvre15-May-15 4:22 
GeneralRe: SOLUTION Pin
Richard Deeming15-May-15 7:07
mveRichard Deeming15-May-15 7:07 
GeneralRe: SOLUTION Pin
Sascha Lefèvre15-May-15 7:50
professionalSascha Lefèvre15-May-15 7:50 

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.