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

The Archive Base Latest Questions

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

I have a function public List<string> UserList() { var q = from i in

  • 0

I have a function

public List<string> UserList()
{
    var q = from i in _dataContext.PageStat group i by new { i.UserName } into ii select new { ii.Key.UserName };
}

How can I return List<string>?

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

    It looks like you just want the distinct set of usernames… why not just use:

    return _dataContext.PageStat.Select(u => u.UserName)
                                .Distinct()
                                .ToList();
    

    If you really want to use grouping, you could do:

    var q = from i in _dataContext.PageStat
            group i by i.UserName into ii
            select ii.Key;
    return q.ToList();
    

    You don’t need all those anonymous types 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 535k
  • Answers 535k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer MS Access 2003 has a curious little feature (I can't… May 17, 2026 at 1:15 am
  • Editorial Team
    Editorial Team added an answer I don't think this is possible. The closest thing to… May 17, 2026 at 1:15 am
  • Editorial Team
    Editorial Team added an answer You do this through a process called "routing". Normally you… May 17, 2026 at 1:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have this Class: public class User { public string id{ get; set; }
I have a function with a List return type. I'm using this in a
I have a function where I get a list of ids, and I need
I have a function written in C# which has one parameter type as Dictionary<string
I have a function that takes a string date in the format 08/24/2010 and
I have the following function that loops through a directory and checks for a
I have a parser function written in my code-behind file, that takes as input
I have a List of words I want to ignore like this one :
I have a view that is displaying a Drop down list using the HTML
I have created a function to implement the regex.split in sql. Here's the code:

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.