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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:44:46+00:00 2026-05-31T22:44:46+00:00

i had created a class with two properties one of datetime datatype and other

  • 0

i had created a class with two properties one of datetime datatype and other of string.

public class name1
{
public DateTime dob { get; set; }
public string name { get; set; }
}

and then page load created a list

    DateTime d1 = new DateTime(1989, 5, 12);
    DateTime d2 = new DateTime(1989, 5, 26);
    DateTime d3 = new DateTime(1989, 3, 12);
    DateTime d4 = new DateTime(1986, 3, 21);
    DateTime d5 = new DateTime(1990, 8, 19);

    List<name1> randmoptn=new List<name1>();
    name1 n1=new name1();
    n1.name="rachit";
    n1.dob=d1;
    name1 n2=new name1();
    n2.name="abhinav";
    n2.dob=d2;
    name1 n3=new name1();
    n3.name="mandeep";
    n3.dob=d3;
    name1 n4=new name1();
    n4.name="jasmeet";
    n4.dob=d4;
    name1 n5=new name1();
    n5.name="rajat";
    n5.dob=d5;
    randmoptn.Add(n1);
    randmoptn.Add(n2);
    randmoptn.Add(n3);
    randmoptn.Add(n4);
    randmoptn.Add(n5);

and now i wanted
desired output should be

year 1986

month 3

21/3/1986 jasmeet

year 1989

month 3

12/3/1989 mandeep

month 5
12/5/1989 rachit

26/5/1989 abhinav

year 1990

month 8

19/8/1990 rajat

  • 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-31T22:44:47+00:00Added an answer on May 31, 2026 at 10:44 pm

    If your desired output is as below

    • Year
    • Month
    • DoB with Name

    then do something like this

    foreach item in YourList  
    {  
       print item.dob.year; // this will return year in integer format
       print item.dob.month; // this will return month in integer format
       print item.dob; // this will return DoB as dateformat, do whatever formating you want 
       print item.name; // this will return Name as String  
    }
    

    print the DoB and Name in the same line if you want

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

Sidebar

Related Questions

public class Car { public string SomeProperty { get; set; } public Manufacturer Manufacturer
For this assignment I had to create my own string class. I initially wrote
I recently had an idea to create my own String class to make using
I had created one HTML page for my experiance. In this i had use
If a set of controls on a WinForm have had DataBindings created and attached
In one of my builds for an iPhone app, I had inadvertently created a
i created a wcf service that had a method: public List<Mail> GetMailItems() { //gets
How can I play two or more audio file in Android? I had created
My problem is a simple one. I've created a class library for Delphi 2007
So for my programming class we have had a project to create a virtual

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.