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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:32:48+00:00 2026-05-15T05:32:48+00:00

Long story short, I have a struct (see below) that contains exactly one field:

  • 0

Long story short, I have a struct (see below) that contains exactly one field:

private int value;

I’ve also implemented implicit conversion operators:

    public static implicit operator int(Outlet val)
    {
        return val.value;
    }

    public static implicit operator Outlet(int val)
    {
        return new Outlet(val);
    }

I’ve implemented all of the following :

IComparable, IComparable<Cart>, IComparable<int>, IConvertible, IEquatable<Cart>, IEquatable<int>, IFormattable

I’m at a point where I really have no clue why, but whenever I serialize this object, I get no value. For instance, with XmlSerialization:

<Outlet />

Also, I’m not solely concerned about XmlSerialization, I’m concerned about ALL serialization (binary for instance) How can I ensure that this serializes properly?

NOTE: I did this because mapping an int,int dictionary seemed rather poorly typed to me when explicit objects with validation behavior were desired.

  • 1 1 Answer
  • 1 View
  • 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-15T05:32:49+00:00Added an answer on May 15, 2026 at 5:32 am

    XML serialization only works with public properties, so you would need to expose a public property that sets/gets the value.

    As an alternative, you can implement IXmlSerializable to manually serialise the structure.

    This is only an issue with XML serialisation. The binary serialiser will serialise private fields as well as public ones.

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

Sidebar

Related Questions

Long story short, I have two regex patterns. One pattern matches things that I
Long story short: I have 2 collections of objects. One contains good values (Let's
Long story short: I have some controller logic that requests a value from the
So long story short, i have some forms (2) of them that, need different
To cut a long story short I have a section of my application that
To cut a long story short I have a C# function that performs a
Long story short, I have a SQL file that I want to import as
Long story short, I have a Java process that reads and writes data to/from
Long story short, I have a form for which I want the id field
long story short, a mistake was made and now I have at least one

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.