Click here to Skip to main content
15,886,547 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: What is null equal to? Pin
Eddy Vluggen27-Aug-14 7:33
professionalEddy Vluggen27-Aug-14 7:33 
GeneralRe: What is null equal to? Pin
sloosecannon27-Aug-14 7:41
sloosecannon27-Aug-14 7:41 
GeneralRe: What is null equal to? Pin
Richard Deeming27-Aug-14 7:53
mveRichard Deeming27-Aug-14 7:53 
GeneralRe: What is null equal to? Pin
jeron126-Aug-14 12:03
jeron126-Aug-14 12:03 
GeneralRe: What is null equal to? Pin
sloosecannon27-Aug-14 3:36
sloosecannon27-Aug-14 3:36 
GeneralRe: What is null equal to? Pin
Rob Grainger27-Aug-14 5:49
Rob Grainger27-Aug-14 5:49 
GeneralRe: What is null equal to? Pin
ColborneGreg31-Aug-14 7:39
ColborneGreg31-Aug-14 7:39 
GeneralRe: What is null equal to? Pin
sankarsan parida4-Sep-14 0:22
professionalsankarsan parida4-Sep-14 0:22 
“==” compares if the object references are same while “.Equals()” compares if the contents are same.
So if you run the below code both “==” and “.Equals()” returns true because content as well as references are same.
object o = ".NET Interview questions";
object o1 = o;
Console.WriteLine(o == o1);
Console.WriteLine(o.Equals(o1));
Console.ReadLine();

True
True

Now consider the below code where we have same content but they point towards different instances. So if you run the below code both “==” will return false and “.Equals()” will return true.
object o = ".NET Interview questions";
object o1 = new string(".NET Interview questions".ToCharArray());
Console.WriteLine(o == o1);
Console.WriteLine(o.Equals(o1));
Console.ReadLine();

False
True
Sankarsan Parida

GeneralRe: What is null equal to? Pin
Munchies_Matt10-Sep-14 12:59
Munchies_Matt10-Sep-14 12:59 
GeneralGive a right username and a right password and you're in... PinPopular
yiangos25-Aug-14 4:38
professionalyiangos25-Aug-14 4:38 
GeneralRe: Give a right username and a right password and you're in... Pin
tgrt25-Aug-14 4:42
tgrt25-Aug-14 4:42 
GeneralRe: Give a right username and a right password and you're in... Pin
PIEBALDconsult25-Aug-14 4:47
mvePIEBALDconsult25-Aug-14 4:47 
GeneralRe: Give a right username and a right password and you're in... Pin
BobJanova1-Sep-14 1:48
BobJanova1-Sep-14 1:48 
GeneralRe: Give a right username and a right password and you're in... Pin
JMK-NI25-Aug-14 4:53
professionalJMK-NI25-Aug-14 4:53 
GeneralRe: Give a right username and a right password and you're in... Pin
Ian Shlasko25-Aug-14 4:55
Ian Shlasko25-Aug-14 4:55 
GeneralRe: Give a right username and a right password and you're in... Pin
yiangos25-Aug-14 5:41
professionalyiangos25-Aug-14 5:41 
GeneralRe: Give a right username and a right password and you're in... Pin
dexterama25-Aug-14 5:06
professionaldexterama25-Aug-14 5:06 
GeneralRe: Give a right username and a right password and you're in... Pin
yiangos25-Aug-14 5:50
professionalyiangos25-Aug-14 5:50 
GeneralRe: Give a right username and a right password and you're in... Pin
PIEBALDconsult25-Aug-14 5:56
mvePIEBALDconsult25-Aug-14 5:56 
GeneralRe: Give a right username and a right password and you're in... Pin
yiangos25-Aug-14 6:05
professionalyiangos25-Aug-14 6:05 
GeneralRe: Give a right username and a right password and you're in... Pin
Marc Koutzarov29-Aug-14 21:44
professionalMarc Koutzarov29-Aug-14 21:44 
GeneralRe: Give a right username and a right password and you're in... Pin
yiangos31-Aug-14 6:38
professionalyiangos31-Aug-14 6:38 
GeneralAndroid gravity constants Pin
Indivara18-Aug-14 22:04
professionalIndivara18-Aug-14 22:04 
GeneralRe: Android gravity constants Pin
Bernhard Hiller19-Aug-14 0:08
Bernhard Hiller19-Aug-14 0:08 
GeneralRe: Android gravity constants Pin
Richard Deeming19-Aug-14 1:47
mveRichard Deeming19-Aug-14 1:47 

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.