473,396 Members | 2,109 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,396 software developers and data experts.

What is this statement mean?

I found this method code in Enterprise Library 2.0 and I really don't have
idea what does it mean.
public virtual void SetParameterValue(DbCommand command, string
parameterName, object value)
{
command.Parameters[BuildParameterName(parameterName)].Value = (value ==
null) ? DBNull.Value : value;
}

In my guess, the "(value == null) ? DBNull.Value : value" means if "value"
parameter is null assign "DBNull.Value", otherwise assign "value" to
command.Parameters[BuildParameterName(parameterName)].Value.

If this is not correct, please correct me guess.

Thank you,
Pound@Gestalt
Jul 27 '06 #1
3 2205
Your guess is dead on. They're called tereny operators:
http://msdn2.microsoft.com/en-us/library/zakwfxx4.aspx

--
Chris Mullins
http://www.coversant.net/blogs/cmullins

"Teeravee Sirinapasawasdee"
<Te**********************@discussions.microsoft.co mwrote in message
news:C7**********************************@microsof t.com...
>I found this method code in Enterprise Library 2.0 and I really don't have
idea what does it mean.
public virtual void SetParameterValue(DbCommand command, string
parameterName, object value)
{
command.Parameters[BuildParameterName(parameterName)].Value = (value ==
null) ? DBNull.Value : value;
}

In my guess, the "(value == null) ? DBNull.Value : value" means if "value"
parameter is null assign "DBNull.Value", otherwise assign "value" to
command.Parameters[BuildParameterName(parameterName)].Value.

If this is not correct, please correct me guess.

Thank you,
Pound@Gestalt

Jul 27 '06 #2
Oops. The other link I gave was to some J-Script documention.

The correct C# link is:
http://msdn2.microsoft.com/en-us/library/ty67wk28.aspx

--
Chris Mullins
http://www.coversant.net/blogs/cmullins

"Teeravee Sirinapasawasdee"
<Te**********************@discussions.microsoft.co mwrote in message
news:C7**********************************@microsof t.com...
>I found this method code in Enterprise Library 2.0 and I really don't have
idea what does it mean.
public virtual void SetParameterValue(DbCommand command, string
parameterName, object value)
{
command.Parameters[BuildParameterName(parameterName)].Value = (value ==
null) ? DBNull.Value : value;
}

In my guess, the "(value == null) ? DBNull.Value : value" means if "value"
parameter is null assign "DBNull.Value", otherwise assign "value" to
command.Parameters[BuildParameterName(parameterName)].Value.

If this is not correct, please correct me guess.

Thank you,
Pound@Gestalt

Jul 27 '06 #3
Chris Mullins <cm******@yahoo.comwrote:
Your guess is dead on. They're called tereny operators:
http://msdn2.microsoft.com/en-us/library/zakwfxx4.aspx
Well, it's an example of a ternary operator, in the same way that "+"
is a binary operator. The name of the operator, however, is the
conditional operator. If ever C# gets another operator with three
operands, that distinction is going to become important :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 27 '06 #4

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

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
4
by: KC | last post by:
I am using JavaScript on an Acrobat form. the script stops at the line "else if (f32.value == "")"shown below. I get the following error message: SyntaxError: syntax error 133:(null) at line 134. ...
19
by: Kalle Anke | last post by:
I'm confused, I want to read/write XML files but I don't really understand what library to use. I've used DOM-based libraries in other languages, is PyXML the library to use?
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
24
by: David Mathog | last post by:
If this: int i,sum; int *array; for(sum=0, i=0; i<len; i++){ sum += array; } is converted to this (never mind why for the moment):
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
4
by: riceyeh | last post by:
Hi, When reading the source code of dojo, it uses the following statement quite often. What does it mean? What I do not understand is it has a function definition enclosed in a pair of parenthesis...
1
by: lovecreatesbea... | last post by:
---quoting--- Annex C (informative) Sequence points 1 The following are the sequence points described in 5.1.2.3: - The end of a full expression: an initializer (6.7.8); the expression in an...
18
by: raghu | last post by:
hello, Iam going through a document contianing C tricks .In it they used the statement in many places i didn't understand can u please tell me the meaning and how the compiler compiles it and runs...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.