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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:38:20+00:00 2026-05-26T14:38:20+00:00

I have a method and I am trying to add another method as a

  • 0

I have a method and I am trying to add another method as a list variable so that I can add multiple Error’s per file. I am currently passing the files list variable to multiple different functions. I would like the Error variable to be contained in the files, but I have been unable to figure it out. Thanks!

    class AllFiles
    {
        public string FileName { get; set; }
        public string FileType { get; set; }
        ...
        public List<ErrorClass> Error { get; set; }
    }

    class ErrorClass
    {
        public int ErrorCode { get; set; }
        public int Total { get; set; }
        public string ErrorMessage { get; set; }
        ...
    }

I use the following to initialize my files as a list so I can add multiple files.

        List<AllFiles> files = new List<AllFiles>();
        files.Add(new AllFiles());

I am wanting it to look like the following:

files[0]
   Error[0]
   Error[1]
files[1]
   Error[0]
   Error[1]
   Error[2]
files[2]
   Error[0]
   ...
  • 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-26T14:38:20+00:00Added an answer on May 26, 2026 at 2:38 pm

    You need to create an instance of the List<ErrorClass> (ideally) inside the AllFiles class’ constructor, and assign it to the Error property.

    Some other recommendations:

    • AllFiles is not a good name for a class that represents one file
    • ErrorClass could maybe just be called Error or FileError
    • The Error property inside AllFiles should be named Errors and should have a private setter.

    E.g.:

    class MyFile {
      public MyFile() {
        Errors = new List<MyFileError>();
      }
    
      public string Name { get; set; }
      public string Type { get; set; }
      ...
      public List<MyFileError> Errors { get; private set; }
    }
    
    class MyFileError {
      public int Code { get; set; }
      public int Total { get; set; }
      public string Message { get; set; }
      ...
    }
    

    Depending on your design, you could better encapsulate the error list inside MyFile and just expose an IEnumerable<MyFileError> and an AddError(MyFileError) method.

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

Sidebar

Related Questions

I'm trying to pass one method to another in elisp, and then have that
I have a method from decompiled code that i am trying to run and
I'm trying to not repeat code, so I have a method that does a
I have a web method that returns a String[][] and I'm trying to parse
I'm trying to unit test a private method that I have attached to my
I have a web service that contains this method: [WebMethod] public static List<string> GetFileListOnWebServer()
I have a huge problem with this method im trying to make. I have
Trying to use GridBagLayout. I have the method called buildLabel. This creates three label.
We have the following method where we are trying to access an array object
I'm trying to test a method I have in my application, but I don't

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.