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 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

This is good: import string string.capwords("proper name") Out: 'Proper Name' This is not so
This might be a stupid question but if there's a better or proper way
This works, but is it the proper way to do it??? I have a
This is a fairly basic question, which for some reason, a proper solution escapes
Roll with me and imagine the following example: Public ViewResult GiveMeFruit(int personId, string personName,
Can anyone instruct me on the proper way to use the MySQLi extension in
Proper MIME type for fonts This matter is solved but i dont know how
I have found this example on StackOverflow: var people = new List<Person> { new
I want to use a temp directory that will be unique to this build.
This is a bit of a long shot, but if anyone can figure it

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.