By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,893 Members | 1,231 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,893 IT Pros & Developers. It's quick & easy.

using nullable types

P: n/a
Hello!

This construction
int? op1 = 5;
int result = op1 * 2;

gived a compile error with
Error 1 Cannot implicitly convert type 'int?' to 'int'. An explicit
conversion exists (are you missing a cast?)
C:\tony\ConsoleApplication1\ConsoleApplication1\Pr ogram.cs 12 26
ConsoleApplication1

If I instead have this construction
int? op1 = 5;
int result = op1 * 2 ?? 12;
Then no compile error will occur.

I mean that because I don't have a nullable type for result it should
give a compile error as the first example did.

//Tony

Jun 30 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Jun 30, 10:55*am, "Tony Johansson" <johansson.anders...@telia.com>
wrote:

<snip>
I mean that because I don't have a nullable type for result it should
give a compile error as the first example did.
Please see my response to your other post.

Jon
Jun 30 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.