interesting boxing problem

C

cody

int a = 1;
short b = 1;
object o1 = a;
object o2 = b;
Console.WriteLine(o1.Equals(o2));

This returns false since the type a and b are not the same. But is there a
way the two objects behave like they would be not in boxed state?
How can I determine wheather 2 boxed objects are the same (It has to take
care of implicit boxing and integer promotion and so on)?
 
M

Mohamoss

Hi
In such case you are limted by the amont of operations you can do on an
object ( which has only 4 member function) . so in such case you can just
compare there Tostring() values. using string comparison of the string
class.
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top