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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:14:33+00:00 2026-06-04T09:14:33+00:00

i have one interface like, public interface Details { int Id { get; set;

  • 0

i have one interface like,

public interface Details
{
    int Id { get; set; }
    string Name { get; set; } 
}        

And i have one method in another class like

public void GetDetails()      
{ 
    List<Details> lstDetails = new List<Details>();        
    DetailsImpl objDetailsImpl;
    Details objDetails = new DetailsImpl();
    for (int i = 1; i <= 2; i++)
    {
        objDetailsImpl = new DetailsImpl(); //The **DetailsImpl** class is given below
        objDetails.Id = i;
        if(i==1)
           objDetails.Name = "FirstName";
        else
           objDetails.Name = "SecondName";
        lstDetails.Add(objDetails);
    }
    objDetailsImpl.InsertRecords(lstDetails);  
}

And i write InsertRecords methods in another derived class like,

public class DetailsImpl : Details
{
    Dictionary<object, object> objDictionary = new Dictionary<object, object>();
    public string Name { get; set; }
    public int Id { get; set; }

    public int InsertRecords(List<Details> lstDetails)
    {
        for (int i = 0; i < lstDetails.Count; i++)
        {
            //i want to get the integer value "Id" from List(lstDetails)
            Id = //How to get the Id value based on count, now the <lstDetails> count is 2

            //i want to get the Name object value also, how to i get???
            Name = Convert.ToString(String.Join(",",lstDetails.Select(s => s.Name).ToArray()));
            //If i using the above line for getting **Name** value means, its comes like "FirstName,LastName", but i want **Name** value based on row.....


            objDictionary.Clear();
            objDictionary.Add("@Id",Id);
            objDictionary.Add("@Id",Name);
            //Here i passed this parameter to "ExecuteNonQry" method for insert operations
            ExecuteNonQry("sp_name",objDictonary,CommandType.StoredProcedure);
        }
        return 1;
    }
}

I want to get Id, Name object values based on list count. How to i solve this?

  • 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-06-04T09:14:35+00:00Added an answer on June 4, 2026 at 9:14 am

    The Name property of the ith element is

    lstDetails[i].Name
    

    It’s worth pointing out that you do not have a List<> you have a List<T> – and you’re not telling us what the T is.

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

Sidebar

Related Questions

So I have this method that get executed repeatedly public static boolean isReady(String dirPath,
I have 2 C# interfaces like this: public interface IEvernoteJobListener { void CopyS3File(S3Location src,
And i have one interface public interface IMethod { String Add(string str); Boolean Update(string
I have a one method interface and a class mocking that interface. The method
I'd like to have one interface for all my grid related tasks.The tasks implement
I have a rest interface for my project. For one class i have a
i have one interface /// <summary> /// Summary description for IBindable /// </summary> public
Let's say I have 2 interfaces defined like so: public interface ISkuItem { public
Say, I have such classes hierarchy: public interface IRepository { } public class SomeSimpleRepository
I have a WCF service which has one method returning a stream. [ServiceContract] public

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.