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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:31:56+00:00 2026-05-14T19:31:56+00:00

I have a datatable whose structure is as under Week Dates Key_Factors Factor_Values —

  • 0

I have a datatable whose structure is as under

Week    Dates       Key_Factors Factor_Values
--- -----       ----------- -------------
1   29/12/2000  Factor_1    19.20
1   29/12/2000  Factor_2    20.67
1   29/12/2000  Factor_3    10
2   21/12/2007  Factor_1    20.54
2   21/12/2007  Factor_4    21.70

I have a Object model like

WeekNumber(int)
Dates(Datetime)
FactorDictionary (Dictionary<string,double>)

I am trying to populate the data from DataTable to my Object Model whose needed output is as under

Desired Output
----------------
WeekNumber : 1
Dates   : 29/12/2000
FactorDictionary: 
    Key_Factors: Factor_1   Factor_Values:19.20
    Key_Factors: Factor_2   Factor_Values:20.67
    Key_Factors: Factor_3   Factor_Values:10

WeekNumber : 2
Dates   : 21/12/2007
FactorDictionary: 
    Key_Factors: Factor_1   Factor_Values:20.54
    Key_Factors: Factor_4   Factor_Values:21.70

i.e. The result is grouped by weeks.

Can I achieve the same by using LINQ.

I am using C#(3.0) with framework(3.5)

Thanks

  • 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-14T19:31:56+00:00Added an answer on May 14, 2026 at 7:31 pm

    I am a bit confused by the way you have worded the question, but yes, you can easily group by weeks from a DateTime field using LINQ. The following group by examples should get you started.

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

Sidebar

Related Questions

I have a dataGridView whose dataSource is a dataTable. My problem is that I
I have a DataTable whose data is being fed into a Class: MyProperty =
I have a data table whose defaultview.sort is already set, and the datatable is
I have a DataTable (instance named: TimeTable) whose DefaultView (instance named: TimeTableView) I am
I have a DataTable which has the following structure. StartDate (Type DateTime) EndDate (Type
I have a GridView on my webpage whose DataSource is a DataTable which is
i have a combobox whose datasource is a datatable. i need to loop through
i have a datagridview whose datasource is attached to a datatable how do i
I have datatable with column name tag and 100 rows of data.I need to
I have a Datatable in my C# program that I would like to INSERT

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.