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

  • Home
  • SEARCH
  • 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 6904299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:02:32+00:00 2026-05-27T08:02:32+00:00

I got this List : private static List<Type> _AbstractTypes = new List<Type>(); and later

  • 0

I got this List :

private static List<Type> _AbstractTypes = new List<Type>();

and later in my project I got a string that corresponds to a Type.FullName.
The thing is that I’d like to check if my string is contained in my List but I don’t manage to avoid a loop usable 🙁
Im looking for something like :

_AbstractTypes.FullName.Contains(myString)

I am absolutely aware that my previous code is not compilable at all but that’s the sort of thing im looking for !
Thanks in advance for any help

  • 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-27T08:02:32+00:00Added an answer on May 27, 2026 at 8:02 am

    You can use Linq, but we are talking about loop-less construct here only, the code under the hood must do a loop, if you want to do it better, you could use HashSet<T>.

    Linq code could look like this:

    _AbstractTypes.Any(t => t.FullName == myString);
    

    HashSet<Type> code could look like this:

    var types = new HashSet<Type>();
    types.Add(typeof(int)); //Fill it with types
    types.Add(typeof(double));
    
    //Check by getting types from their string name, you could of course also cache those types
    Console.WriteLine("Contains int: " + types.Contains(Type.GetType(intName))); //True
    Console.WriteLine("Contains float: " + types.Contains(Type.GetType(floatName))); //False
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a class somewhat like this: public class Test { private final List<ISomeType>
I got a view that inherits : System.Web.Mvc.ViewPage<IEnumerable<MyProjects.Models.MyAccountWrapper>> In this view I list data
In Python, I've got a list of dictionaries that looks like this: matchings =
I've got a static class (DataFormSubject) that holds a generic List object, as follows:
In one of my classes, I have got code: private static void Notify(string url,
Ok, I've got a list like this (just a sample of data): data =
I have this but I got an error: -- test if a list contains
Got this line of code here but its not working. private void Button_Click(object sender,
I got this error today when trying to open a Visual Studio 2008 project
I've got two entities ServiceDownload.java @Entity public class ServiceDownload implements Serializable { private static

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.