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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:30:43+00:00 2026-05-26T15:30:43+00:00

I have the following code files: public interface IMod { string Name { get;

  • 0

I have the following code files:

public interface IMod
{
    string Name { get; set; }
    string Description { get; set; }
    bool Enabled { get; set; }
    List<IClassFile> ClassFiles { get; set; }
}
public interface IClassFile
{
    string Path { get; set; }
    string FileName { get; set; }
    bool Enabled { get; set; }
}
public class ClassFile : IClassFile
{
    public string Path { get; set; }
    public string FileName { get { return System.IO.Path.GetFileName(Path); } }
    public bool Enabled { get; set; }

    ....
}
public class ZippedMod : IMod
{
    public string Name { get; set; }
    public string Description { get; set; }
    public bool Enabled { get; set; }
    public List<IClassFile> ClassFiles { get; set; }

    ....
}
public class ConfigurationBlock
{
    public List<IMod> Mods { get; set; }

    ....
}

Throughout the course of my program, I add a few ZippedMods to the ConfigurationBlock, but now I want to serialize them. I tried doing:

using (var stream = new StreamWriter("config.xml"))
{
    var ser = new XmlSerializer(typeof(ConfigurationBlock));
    ser.Serialize(stream, configBlock);
}

But I get this error:

There was an error reflecting type 'MinecraftModManager.ConfigurationBlock'.
|-Inner Exception:
      Cannot serialize member 'MinecraftModManager.ConfigurationBlock.Mods' of type 'System.Collections.Generic.List`1[[MinecraftModManager.IMod, MinecraftModManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]', see inner exception for more details.
      |-Inner Exception:
            Cannot serialize member MinecraftModManager.ConfigurationBlock.Mods of type MinecraftModManager.IMod because it is an interface.

Help?

  • 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-26T15:30:43+00:00Added an answer on May 26, 2026 at 3:30 pm

    You can’t serialize an interface due to the abstract nature of them. Lots of concrete types can implement the same interface, so it creates an ambiguity. You must use a concrete type.

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

Sidebar

Related Questions

I have the following code: public interface IMyInterface { DataGrid ItemsInGrid { get; set;
I have the following code: public class DeserializeAndCompare { public static List<string> IntoXML() {
my application has the following code: public interface IConfigurationManager { CustomSection Settings { get;
I have used following code for download some files from our internet. public class
Have a look at following code: @Local public interface MyService { void printMessage(); }
I have three files: ScriptProcessor.java: public interface ScriptProcessor { public String someMethod(); } ScriptProcessorDummy.java:
I have the following code to zip all the files and then save it
I have a simple application with the following code: FileInfo[] files = (new DirectoryInfo(initialDirectory)).GetFiles();
I have the following js files in my code for EditInPlace... <?php echo $javascript->link('jquery.js');?>
I have the following API: public interface MyApi { /** * Performs some stuff.

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.