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 9148193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:12:32+00:00 2026-06-17T11:12:32+00:00

I have a complex class whose fields can be lists dictionaries and any other

  • 0

I have a complex class whose fields can be lists dictionaries and any other classes. Some basic data types are int , bool, string or some enums. I need to created a functions that takes an instance of that class and a string and return true or false depending if there is a mentioning of the string.

public class Record
  {
    public Dictionary<string,int> Counts { get; set; }
    public Dictionary<string,list<string>> Syns {get; set;}
    public string Name { get; set; }
    public KeyValuePair<string,KeyValuePair<string,bool>> Stuff { get; set; }
    //etc 
  }

Here is what the method should do

   public static bool IsValuePresent(Object o, string keyword)
     {
       //cycle through all possible string values of o and check if keyword is present. 
       //return true if so, otherwise false
     } 

possible call:

 Record record = dbAccess.GetCurrent();
 bool flag = IsValuePresent(record, "Name");

Remark: can use ToJSON but this will verify if "name" is present among names of of object properties, but it should only verify values.

  • 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-06-17T11:12:33+00:00Added an answer on June 17, 2026 at 11:12 am

    You should be able to use recursion and use System.Reflection. Here is a good post:

    Reflection – Iterate object's properties recursively within my own assemblies (Vb.Net/3.5)

    Look at:

    foreach (PropertyInfo pi in o.GetType().GetProperties())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quite complex class hierarchy in which the classes are cross-like depending
I have two (unrelated) classes. The first one is Point: typedef std::complex<double> complex_number; class
I`m trying to display classes that have properties of type some custom class inside
I have a rather complex base class for some sqlalchemy models and I want
I have a class with a complex construction process with many parameters. Multiple clients
I have a PHP class that stores a complex multidimensional array, and rather than
I am using WCF and REST, and I have complex types, which are working
I have some complex message to show inside of a flash message so instead
I have several complex data structures like Map< A, Set< B > > Set<
So how do you display complex aggregated ViewModels whose Models have relations to each

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.