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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:15:47+00:00 2026-05-17T19:15:47+00:00

We have a DAL that we’re using with NHibernate.Search , so classes that need

  • 0

We have a DAL that we’re using with NHibernate.Search, so classes that need to be indexed are decorated with an attribute Indexed(Index:="ClassName"), and each property that needs to be be indexed has an attribute Field(Index:=Index.Tokenized, Store:=Store.No) . When one wants the index to drill down special objects, there’s the attribute IndexedEmbedded()

In order to auto-document our indexation hierarchy, i’ve built a simple parser that runs through the DAL assembly, picks up any class marked as indexable and gets the properties that are either indexable or whose type is available for drill-down. When the type of the property is declared as available for drill-down, i push this type into the queue and process it too.

The problem is that among the classes you can drill down into, some are themselves contained in IEnumerable generic collections. I’d like to get at the type used for the collection (usually ISet) to parse it too.

So what’s the way to get the inner type of a collection?

Private m_TheMysteriousList As ISet(Of ThisClass)
<IndexedEmbedded()> _
Public Overridable Property GetToIt() As ISet(Of ThisClass)
   Get
        Return m_TheMysteriousList
   End Get
   Set(ByVal value As ISet(Of ThisClass))
        m_TheMysteriousList = value
   End Set
End Property

How do i get to ThisClass when i have the PropertyInfo for GetToIt?

  • 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-17T19:15:47+00:00Added an answer on May 17, 2026 at 7:15 pm

    Something like:

    public static Type GetEnumerableType(Type type)
    {
        if (type == null) throw new ArgumentNullException();
        foreach (Type interfaceType in type.GetInterfaces())
        {
            if (interfaceType.IsGenericType &&
                interfaceType.GetGenericTypeDefinition() == typeof(IEnumerable<>))
            {
                return interfaceType.GetGenericArguments()[0];
            }
        }
        return null;
    }
    ...
    PropertyInfo prop = ...
    Type enumerableType = GetEnumerableType(prop.PropertyType);
    

    (I’ve used IEnumerable<T> here, but it is easily adjusted to suit any other similar interface)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a DAL using the Entity Framework. We have some DAL classes (I
So you have a DAL in C# that using the Repository pattern and you
I have a DAL class library that is included in my program as a
I have a data access layer (DAL) that is written in ASP.NET 3.5 and
I'm manually creating a WCF service that will act as a DAL and have
I have a small winapp that uses LinqToSQL as it's DAL. I am creating
I have an 3-layered project, so that all Linq-Querys himself are in the DAL.
I have a .NET 3.5 assembly, a DAL, that connects to a database through
I use massive.cs as a DAL, but I create Models that have Lists for
I have generated a DAL layer with Subsonic2.2 for a .NET4.0 application, using c#

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.