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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:05:05+00:00 2026-05-21T10:05:05+00:00

In my project I was throwing a list of error messages like this List<string>

  • 0

In my project I was throwing a list of error messages

like this

 List<string> errorMessageList = errors[0].Split(new char[] { ',' }).ToList();

 throw new WorkflowException(errorMessageList);

and my WorkflowException class looks like this

/// <summary>
/// WorkFlowException class
/// </summary>
public class WorkFlowException : Exception
{
    /// <summary>
    /// Initializes a new instance of the WorkFlowException class
    /// </summary>
    /// <param name="message">Error Message</param>
    public WorkFlowException(List<string> message)
    {
        base.Message = message;
    }
}

but getting errors while assigning this list of messages to base.Message
can anybody help me to do 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-05-21T10:05:06+00:00Added an answer on May 21, 2026 at 10:05 am

    Exception.Message is a string, not a List<string>, and it’s read-only, so you have to pass a string to the base class via constructor chaining:

    public class WorkFlowException : Exception
    {
        public WorkFlowException(List<string> messages)
        : base(messages != null && messages.Count > 0 ? messages[0] : "")
        { 
          //...
        }
    }
    

    Alternatively, you can override the Message property:

    public class WorkFlowException : Exception
    {
        List<string> messages;
    
        public WorkFlowException(List<string> messages)
        { 
          this.messages = messages
        }
    
        public override string Message
        {
          get { return messages != null && messages.Count > 0 ? messages[0] : "" }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When throwing a FaultException<CustomFault> like this: throw new FaultException<CustomFault>(new CustomFault(Custom fault message)); I get
A C++ project I'm working on terminates upon throwing a first-chance exception. This occurs
For some reason, my project has messed up and now its throwing errors every
my symfony project at production when an actions does not exist is throwing error
I'm thinking about throwing away my DB in my next project to simplify development/evolution.
i'm currently refactoring a C-project, throwing about 1000 warnings at me. is there a
My project is currently using a svn repository which gains several hundred new revisions
I've got a Visual Studio project that recently started throwing a ConfigurationErrorsException, and I
In my project, i have imported some third party frameworks like google-maps. EveryThing work
I have some C# code in my ASP.NET MVC3 project that's throwing an exception

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.