Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 637067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:35:02+00:00 2026-05-13T20:35:02+00:00

What is the equivalent in C# for Delphi’s in syntax, like: if (iIntVar in

  • 0

What is the equivalent in C# for Delphi’s in syntax, like:


  if (iIntVar in [2,96]) then 
  begin
    //some code
  end;

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:35:02+00:00Added an answer on May 13, 2026 at 8:35 pm

    I prefer a method like defined here: Comparing a variable to multiple values

    Here’s the conversion of Chad’s post:

    public static bool In(this T obj, params T[] arr)
    {
        return arr.Contains(obj);
    }
    

    And usage would be

    if (intVar.In(12, 42, 46, 74) ) 
    { 
        //TODO: Something 
    } 
    

    or

    if (42.In(x, y, z))
        // do something
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any equivalent of DocTest for Delphi. I use DUnit but I like
Does anyone know of an equivalent to FxCop/StyleCop for Delphi? I would really like
What is the equivalent Delphi code for the following in C: int32 *P; int32
I am doing a project converting some Pascal (Delphi) code to C++ and would
I would like to know Delphi equivalent of the following operators. ++i/--i i++/i-- i+=1/i-=1
I had some code before I moved to Unicode and Delphi 2009 that appended
I have some delphi code which I need to migrate / port / re-write
Exist a .net class equivalent to the TTimer delphi component? TTimer is used to
I am looking for a method equivalent to Delphi's System.Frac in .NET. The Delphi
I to need create a programmatic equivalent using delphi language... or could someone post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.