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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:59:38+00:00 2026-05-16T06:59:38+00:00

Is this is a proper use of IEnumerable or shell I use List ?

  • 0

Is this is a proper use of IEnumerable or shell I use List?
what do I need to put in <PropertyInfo>?

public static IEnumerable<PropertyInfo> GetNewsList<T>(int FID)
    {
        CatomWebNetDataContext pg = (CatomWebNetDataContext)db.GetDb();
        return (from nls in pg.NewsCat_ITEMs
                  join vi in pg.VIRTUAL_ITEMs on nls.NC_VI_ID equals vi.VI_ID
                  where vi.VI_VF_ID == FID
                  select new { nls, vi });


    }

or

 public List<PropertyInfo> GetPublic<T>(int FID)
    {
        CatomWebNetDataContext pg = (CatomWebNetDataContext)db.GetDb();
        var nl = (from nls in pg.NewsCat_ITEMs
                join vi in pg.VIRTUAL_ITEMs on nls.NC_VI_ID equals vi.VI_ID
                where vi.VI_VF_ID == FID
                select new { nls, vi });

        List<PropertyInfo> retList = new List<PropertyInfo>();

        foreach (var item in nl)
        {
             retList.Add(item);
        }


        return retList;
    }
  • 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-16T06:59:39+00:00Added an answer on May 16, 2026 at 6:59 am

    The list is an instace of type, that implements IEnumerable. What it means? That if you want to return the IEnumerable<PropertyInfo> you have to create a list (or array etc.) of it and then return it.. From the outside of the method it will look like you are returning IEnumerable<PropertyInfo> but really it will be a List<PropertyInfo>.

    About your query… You have to select object of type PropertyInfo, but right now you ae returning some anonymouse type. You should try it like this:

    public static IEnumerable<PropertyInfo> GetNewsList<T>(int FID)
    {
        CatomWebNetDataContext pg = (CatomWebNetDataContext)db.GetDb();
        var result from nls in pg.NewsCat_ITEMs
                   join vi in pg.VIRTUAL_ITEMs on nls.NC_VI_ID equals vi.VI_ID
                   where vi.VI_VF_ID == FID
                   select new PropertyInfo { SomeMember = nls, SomeOtherMember = vi };
    
        return result.ToList();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is this the proper way to use a static const variable? In my top
What is the proper way to use URL parameters? My URL is this: http://localhost:8080/#pg5?testing=abc
Is this the proper way to use the .animate(top) function? Positive number (animate down)--
Let's suppose I have some method that returns a IEnumerable<int> object. This methods make
the code i'm using is below. Is this the proper way to use Session?
What is the proper use of Moq.MockRepository.Of() and Moq.MockRepository.OneOf()? I've tried something like this
This isn't a style question. Its more about the proper use of the language
Is this proper use of std::enable_if? It works, but is it correct? //*.h file
What is the proper use of the this self-reference of a class? I sometimes
From the question: Proper use of this-> The answer states that -> can be

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.