Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2007

Tip: Looking for answers? Try searching our database.

CodeDom conditional expression.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin Burton - 07 Jan 2007 09:15 GMT
I would like to know the sequence of calls required to create a conditional
expression like:

if(a != null)
{
}

So far I have only come up with

if(a)
{
}

Which will work but I would like to know how to form expressions with '!=',
'==', '>', etc.

Thank you for your help.

Kevin Burton
Damien - 08 Jan 2007 10:01 GMT
> I would like to know the sequence of calls required to create a conditional
> expression like:
[quoted text clipped - 15 lines]
>
> Kevin Burton

Hi Kevin,

It would have helped if you'd posted the code you had already, so we
could work and adapt from that. Here's some code from one of my
projects, in VB, but should be amenable to use in C# if that's your
poison:

           ifActualChange.Condition = New
CodeBinaryOperatorExpression(col.mVarRef,
CodeBinaryOperatorType.IdentityInequality, __Nothing)

where col.mVarRef is a property that returns a
CodeVariableReferenceExpression, and __Nothing is a global variable set
to a CodePrimitiveExpression of Nothing (you'd use a
CodePrimitiveExpression of null in C#).

You should find that CodeBinaryOperatorExpression meets most of your
needs, although I've found it to be curiosly limitied in some places in
the past.

Damien

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.