Click here to Skip to main content

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, embarrasing 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 PinmemberJulien Villers20-Sep-12 4:29 
GeneralRe: C# properties and type safety PinmemberEddy Vluggen20-Sep-12 6:45 
GeneralRe: C# properties and type safety PinmemberJulien Villers20-Sep-12 9:30 
GeneralRe: C# properties and type safety PinmemberBobJanova20-Sep-12 7:29 
GeneralRe: C# properties and type safety [modified] PinmemberCIDev20-Sep-12 4:57 
GeneralRe: C# properties and type safety PinmemberZac Greve20-Sep-12 6:35 
GeneralRe: C# properties and type safety PinmemberSimulationofSai29-Sep-12 14:42 
GeneralC# Exception handling 101 PinmemberJulien Villers19-Sep-12 23: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 PinmemberAndrei Straut19-Sep-12 23:48 
GeneralRe: C# Exception handling 101 PinmemberCIDev20-Sep-12 4:10 
GeneralRe: C# Exception handling 101 PinmemberNaerling21-Sep-12 23:01 
GeneralRe: C# Exception handling 101 PinmemberJulien Villers23-Sep-12 23:55 
GeneralRe: C# Exception handling 101 PinmemberNaerling24-Sep-12 9:09 
GeneralRe: C# Exception handling 101 PinmemberJonathan C Dickinson30-Sep-12 22:51 
GeneralRe: C# Exception handling 101 PinmemberJulien Villers30-Sep-12 23:23 
QuestionWhy? PinprotectorAspDotNetDev18-Sep-12 16:27 
AnswerRe: Why? PinmemberPIEBALDconsult18-Sep-12 19:29 
GeneralRe: Why? PinprotectorAspDotNetDev18-Sep-12 19:37 
AnswerRe: Why? PinmemberAndrei Straut19-Sep-12 2:42 
GeneralRe: Why? PinprotectorAspDotNetDev19-Sep-12 7:31 
AnswerRe: Why? PinmemberChris Meech19-Sep-12 3:18 
GeneralRe: Why? PinprotectorAspDotNetDev19-Sep-12 7:33 
AnswerRe: Why? PinprotectorPete O'Hanlon19-Sep-12 3:38 
GeneralRe: Why? PinprotectorAspDotNetDev19-Sep-12 7:34 
AnswerRe: Why? PinmemberSentenryu19-Sep-12 6:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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.141223.1 | Last Updated 25 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid