homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

C# syntax question

 4:57 am on Jul 25, 2007 (gmt 0)


I remember i saw somewhere a quick and dirty c# syntax, like:
(Variable(or expression i dont remeber), 1)

if it is evaluated null returns 1. has anybody bumped into this?

it has been stuck in my head all day; like a friend's name u try to remember.


[edited by: BlackTulip at 4:58 am (utc) on July 25, 2007]



 6:03 am on Jul 25, 2007 (gmt 0)

I'm still in the very early learning stages of C# and your question is a little confusing to me. Are you referring to the equivalent of something like the conditional IIf in Visual Basic? Is so I think the proper syntax in C# is:

o = (cond1 = cond2? truevalue : falsevalue);

If I'm wrong I'm sorry. And hopefully I'll learn something in the process. Are you having an easy time learning C#?


 3:29 am on Jul 26, 2007 (gmt 0)

Thank you GaryK, I think thats the one i was trying to recall. you saved my brain from a nagging loop!

I love c#, everything aside I find it quite elegant.

PS: so is this kinda IF imported from VB?

[edited by: BlackTulip at 3:30 am (utc) on July 26, 2007]


 6:06 am on Jul 26, 2007 (gmt 0)

I'm fluent in many computer languages so learning C# is just a matter of learning the right syntax for stuff, and finding the time to dedicate to learning without being interrupted.

Most languages that I've used have the equivalent of that conditional statement. VBScript being the notable exception.



 8:39 pm on Jul 26, 2007 (gmt 0)

This would be the Ternary Operator.

Lord Majestic

 8:43 pm on Jul 26, 2007 (gmt 0)

> PS: so is this kinda IF imported from VB?

That short style IF syntax taken from original K&Rs C - I find C# so much better :)


 12:46 am on Jul 27, 2007 (gmt 0)

cool now I know its called a Ternary operation.

this reminds me of my renewed interest to re-study Math, god know how many credits of Math I have forgotten.



 1:06 pm on Jul 27, 2007 (gmt 0)

That's ironic BlackTulip... I'm refreshing on Statistics right now. That stuff is 20 years behind me and your right, you do forget it.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved