Jeff Garoutte

c# .net and anything else that happens across my desk

Variable boxing and == vs. Equals

Let's take a moment and think about exactly how boxed variables work when checking to see if they are equal. Here is a little Console application to do a quick comparison of how the Equals function and == operator work. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace VariableBoxEqualityTest { class Program { static void Main(string[] args) { int x = 1; int y = 1; test(x, y); ... [More]
Posted: Jun 18 2009, 10:04 by jeff | Comments (3) RSS comment feed |
Filed under: General | Research
Tags:
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us