473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Interesting question

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!!
Oct 5 '06 #1
2 1116
"Diffident" <Di*******@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
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...
Oct 5 '06 #2
q
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!!
Oct 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pythonUser_07 | last post by:
Is this the correct place to post a jython question? I posted the following in the jython group, but I figured I'd post here too: _________________________________________ I am assuming that...
8
by: ºa¤Ö | last post by:
I find a interesting question, and I cannot solve it @.@ If i want to insert unicode data, I need using recordset.addnew instead of using "insert into table" query or "stored procedure" All...
2
by: Dylan Phillips | last post by:
A strang error is occurring when I run the following code: SqlConnection c = new SqlConnection(); c.ConnectionString = "Initial Catalog=Northwind;user id=sa;password=kat1ie;Data Source=server";...
7
by: git_cs | last post by:
Hey, guys and gals Somedays ago, I had asked for the DES algorithm in C language. Although I have written the algorthim in C myself, I am facing a peculiar problem, which I hope some of u guys and...
7
by: Jax | last post by:
I have this code, behold: string message = "Are you sure? You will lose this customer forever. (Well you'll have re-create from scratch)"; string caption = "Delete"; MessageBoxButtons buttons...
12
by: Dino M. Buljubasic | last post by:
I have two applications App1 and App2. App1 is just checking for new version of App2. If it finds newer version of App2 it will download App1 AND App2. (both of them). That is what I am...
6
by: Claude Yih | last post by:
Hi, everyone. I noticed an interesting thing about fread() this afternoon. Well, I can't see why so I post this message in the hope of getting some explanation. Please help me. I wrote the...
26
by: v4vijayakumar | last post by:
Happened to see my old (last millennium) c code. Almost forgot that I wrote it . It is interesting. :-) int sqrt(int no) { int t; no = t * t; return t; }
5
by: Will Honea | last post by:
I've hit an interesting trap trying to migrate data off an OS/2 server running version 7.2 (fp14) over to 8.2 on Linux. Seems that one table has a column defined in the DDL as "BIGINT NOT NULL...
126
by: jacob navia | last post by:
Buffer overflows are a fact of life, and, more specifically, a fact of C. All is not lost however. In the book "Value Range Analysis of C programs" Axel Simon tries to establish a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.