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

C#NET2008 What's the meaning of operator ?

126 100+
Hullo Good Guys,
I need your help, Please help me.

I noticed the use of this operator ?
What's the meaning of it.

This is the coding that contained ?
Expand|Select|Wrap|Line Numbers
  1. txtCustomer.text = DR["CompanyName"] == System.DBNull.Value ? string.Empty : Convert.ToString(DR["CompanyName"]);
  2.  
  3. txtAddress.text =  DR["Address"] == System.DBNull.Value? string.Empty: Convert.ToString(DR["Address"]);
  4.  
  5.  

Thank you for your help.
Jan 1 '11 #1

✓ answered by Subin Ninan

Expand|Select|Wrap|Line Numbers
  1. int i = (1 < 2) ? 1 : 2;
  2.  
this is an inline assignment operator on basis of if condition. Value of variable i after execution will be 1.

Value = (condition)?<then part>:<else part>;

4 1983
Joseph Martell
198 Expert 128KB
The "?" is actually 1 part of the ?: ternary operator. Look at this documentation from MSDN for more information.

Unlike most of the other operators, this one is a little difficult to look up if your not familiar with it.
Jan 2 '11 #2
lenniekuah
126 100+
Hi Joseph Martell,
Thank you for the URL Link and also for sharing the informatio with me. I will check it out and try it out of my coding.

Thank you.
Jan 2 '11 #3
Expand|Select|Wrap|Line Numbers
  1. int i = (1 < 2) ? 1 : 2;
  2.  
this is an inline assignment operator on basis of if condition. Value of variable i after execution will be 1.

Value = (condition)?<then part>:<else part>;
Jan 3 '11 #4
lenniekuah
126 100+
Hi Subin Ninan,
Thank you very much for sharing the information with me.
It has help me logically.
Jan 3 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: cppaddict | last post by:
Hi, How, in general, does the default operator= work? That is, say I have a custom class MyClass and do: MyClass defaultMyClass; MyClass initializedMyClass("set","some","members");...
2
by: Vineet | last post by:
Hello, Can ANy body tell me what is the emaning of $$<var_name> in PHP. Regards, Vineet http://www.compose.co.in
4
by: PengYu.UT | last post by:
The following shows the source code and the error message(from g++-3.3). I wrote two assignment operator. One is for the same type case, the other one is for different type case. I'm wondering why...
17
by: Anoob | last post by:
Can we consider () unary operator when calling a function, in exps eq. f(), ( 1 + 2). But when we call function f( 10 ) it is a binary operator. Even if we pass f( 10, 20) as we are using ,...
4
by: bingfeng | last post by:
I have some codes generated by perl, in which initialize some huge struct,such as PARA TOS_network_spantree_set_0_para_0 = { "vlan", emNUM, NULL, "", "configuration on a designated vlan",...
7
by: newbie | last post by:
anyone know is it this source code value:- T = ((Y >> 4) ^ X) & 0x0F0F0F0F; X ^= T; Y ^= (T << 4); T = ((Y ) ^ X) & 0x10101010; X ^= T; Y ^= (T ); X = (LHs << 3) | (LHs << 2)...
4
by: DoomedLung | last post by:
What does this operator ">-" stand for or mean, as in... this.ver = navigator.appVersion; this.agent = navigator.userAgent; this.dom = document.getElementById ? 1 : 0; this.opera5 =...
3
by: stork | last post by:
If I see a piece of code like: someobject.stringProperty = @mycontrol.Text; What does the @ do in that case? Is that a clone operator?
4
by: sam | last post by:
Hi, I just want to ask the question about this code int len =0; len =5; "x41" * (len); In this is "x41" is multiply by 5 or it just can acquire space like this x41x41x41x41x41 . I am a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.