Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Interesting question

Reply
Thread Tools

Interesting question

 
 
=?Utf-8?B?RGlmZmlkZW50?=
Guest
Posts: n/a
 
      10-05-2006
Hi All,

Can anyone explain me why when I convert a null object to an 32-bit integer
the result is zero?

Convert.ToInt32(null) = 0?

Thanks!!
 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      10-05-2006
"Diffident" <> wrote in message
news:8EDA0EC0-D66B-4839-968E-...

> Can anyone explain me why when I convert a null object to an 32-bit
> integer
> the result is zero?
>
> Convert.ToInt32(null) = 0?


Because the default value of an int variable is zero...


 
Reply With Quote
 
 
 
 
q
Guest
Posts: n/a
 
      10-05-2006
Int32 is not nullable and 0 is the default value.

You can do this to see it.

Int32 id = default(Int32)

On Oct 5, 4:41 pm, Diffident <Diffid...@discussions.microsoft.com>
wrote:
> Hi All,
>
> Can anyone explain me why when I convert a null object to an 32-bit integer
> the result is zero?
>
> Convert.ToInt32(null) = 0?
>
> Thanks!!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interesting problem with NAT and VPN (not the usual question) Jim Westwood Cisco 6 10-15-2005 05:07 PM
Interesting Inheritance question with Inner classes Christian Bongiorno Java 2 05-10-2004 10:01 AM
Interesting Casting question =?ISO-8859-1?Q?Andreas_R=F8sdal?= Java 3 03-03-2004 10:22 PM
Interesting VoIP Bandwidth Question Kengie Cisco 2 12-10-2003 08:25 AM
Interesting Database Query Question!! Jay ASP .Net 1 10-02-2003 10:58 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57