473,387 Members | 1,673 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,387 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 1986
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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
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,...

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.