Click here to Skip to main content
12,449,762 members (84,936 online)

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: C# properties and type safety Pin
Julien Villers20-Sep-12 3:29
memberJulien Villers20-Sep-12 3:29 
GeneralRe: C# properties and type safety Pin
Eddy Vluggen20-Sep-12 5:45
memberEddy Vluggen20-Sep-12 5:45 
GeneralRe: C# properties and type safety Pin
Julien Villers20-Sep-12 8:30
memberJulien Villers20-Sep-12 8:30 
GeneralRe: C# properties and type safety Pin
BobJanova20-Sep-12 6:29
memberBobJanova20-Sep-12 6:29 
GeneralRe: C# properties and type safety Pin
CIDev20-Sep-12 3:57
memberCIDev20-Sep-12 3:57 
GeneralRe: C# properties and type safety Pin
Zac Greve20-Sep-12 5:35
memberZac Greve20-Sep-12 5:35 
GeneralRe: C# properties and type safety Pin
SimulationofSai29-Sep-12 13:42
memberSimulationofSai29-Sep-12 13:42 
GeneralC# Exception handling 101 Pin
Julien Villers19-Sep-12 22:26
memberJulien Villers19-Sep-12 22:26 
Here's a 'nice' pattern I saw in some code I've inherited...

catch (Exception ex)
{
	if (ex is ExceptionSpecialType)
		throw new SomeException()
		{
			CustomData = (ex as ExceptionSpecialType).SomeThing.ToXmlString()
		};
	else
	{
		// <-- Some specific handling removed here -->
		throw new SomeException()
		{
			CustomData = new CustomError(ex).ToXmlString()
		};
	}
}

Oh, and yes, my predecessor loved using 'if (X is T) (X as T).M();'.
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

GeneralRe: C# Exception handling 101 Pin
Andrei Straut19-Sep-12 22:48
memberAndrei Straut19-Sep-12 22:48 
GeneralRe: C# Exception handling 101 Pin
CIDev20-Sep-12 3:10
memberCIDev20-Sep-12 3:10 
GeneralRe: C# Exception handling 101 Pin
Naerling21-Sep-12 22:01
memberNaerling21-Sep-12 22:01 
GeneralRe: C# Exception handling 101 Pin
Julien Villers23-Sep-12 22:55
memberJulien Villers23-Sep-12 22:55 
GeneralRe: C# Exception handling 101 Pin
Naerling24-Sep-12 8:09
memberNaerling24-Sep-12 8:09 
GeneralRe: C# Exception handling 101 Pin
Jonathan C Dickinson30-Sep-12 21:51
memberJonathan C Dickinson30-Sep-12 21:51 
GeneralRe: C# Exception handling 101 Pin
Julien Villers30-Sep-12 22:23
memberJulien Villers30-Sep-12 22:23 
QuestionWhy? Pin
AspDotNetDev18-Sep-12 15:27
protectorAspDotNetDev18-Sep-12 15:27 
AnswerRe: Why? Pin
PIEBALDconsult18-Sep-12 18:29
memberPIEBALDconsult18-Sep-12 18:29 
GeneralRe: Why? Pin
AspDotNetDev18-Sep-12 18:37
protectorAspDotNetDev18-Sep-12 18:37 
AnswerRe: Why? Pin
Andrei Straut19-Sep-12 1:42
memberAndrei Straut19-Sep-12 1:42 
GeneralRe: Why? Pin
AspDotNetDev19-Sep-12 6:31
protectorAspDotNetDev19-Sep-12 6:31 
AnswerRe: Why? Pin
Chris Meech19-Sep-12 2:18
memberChris Meech19-Sep-12 2:18 
GeneralRe: Why? Pin
AspDotNetDev19-Sep-12 6:33
protectorAspDotNetDev19-Sep-12 6:33 
AnswerRe: Why? PinPopular
Pete O'Hanlon19-Sep-12 2:38
protectorPete O'Hanlon19-Sep-12 2:38 
GeneralRe: Why? Pin
AspDotNetDev19-Sep-12 6:34
protectorAspDotNetDev19-Sep-12 6:34 
AnswerRe: Why? Pin
Sentenryu19-Sep-12 5:17
memberSentenryu19-Sep-12 5:17 

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 | Mobile
Web01 | 2.8.160826.1 | Last Updated 26 Aug 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid