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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:31:18+00:00 2026-05-26T07:31:18+00:00

i have a t_my_class table structure like below (MySql table) id class group age

  • 0

i have a t_my_class table structure like below (MySql table)

id     class     group     age     name     surname
1      9         A         18      sarah    brown
2      10        B         20      joe      sanders
3      8         A         17      elisa    connor
4      10        C         23      sandra   brown

and i have a struct and a list of that struct

struct MyClass
{
   int id;
   string class;
   string group;
   int age;
   string name;
   string surname;
}
List<MyClass> Students = new List<MyClass>();

Now, can u tell me which LINQ query to use to select all data from t_my_class table to Students List.

  • 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-26T07:31:19+00:00Added an answer on May 26, 2026 at 7:31 am

    Firstly, that should almost certainly not be a struct – it should be a class. Now, you have a couple of choices; if you do already have a LINQ-enabled ORM hooked up, then it should be simply:

    var students = myContext.Students.ToList();
    

    If you aren’t already using an ORM tool then a micro-ORM might help, for example dapper-dot-net works with MySql AFAIK, allowing:

    var students = connection.Query<Student>("select * from t_my_class").ToList();
    

    With:

    class Student
    {
       public int Id {get;set;}
       public string Class {get;set;}
       public string Group {get;set;}
       public int Age {get;set;}
       public string Name {get;set;}
       public string Surname {get;set;}
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know how to query this one out. I have a table structure
I have a database with the following structure: CREATE TABLE entity ( id SERIAL,
I have a generic class in my project with derived classes. public class GenericClass<T>
I have a ruby file as follows: module Example class Myclass def t_st Hello
I have a generic class public MyClass<TContext, T> where TContext : DataContext that effectively
I have got a template class as follows: class MyClass<T> { T field; public
I have a templated class defined (in part) as template <class T> MyClass {
I don't have access to my dev environment, but when I write the below:
I don't have admin rights to my pc, but would like to use Mercurial
I have a card-game application which makes use of Single Table Inheritance. I have

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.