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

  • Home
  • SEARCH
  • 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 738525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:50:47+00:00 2026-05-14T07:50:47+00:00

This might be a stupid question but I’ll ask anyway, I was reading OOP

  • 0

This might be a stupid question but I’ll ask anyway,

I was reading “OOP Demystified: A Self-Teaching Guide by Jim Keogh and Mario Giannini” chapter 11 which covers interfaces. The examples in this book are C++.

I noticed that C++ uses ISerializable to make a class serializable which you would implement where as in C# you just attribute the class with the [Serializable] attribute.

What is the key difference here? Is it that with an interface you must provide the implementation where as if you attribute something the compiler will work out the implementation for you?

I guess that with the [Serializable] attribute the .Net framework uses reflection to make the serialized object from the actual object.

That said is it possible in that case to have an [Disposable] attribute or using my theory above the framework wont know how to actually dispose of an object hence you have to do it yourself?

Would be grateful for a clarification.

  • 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-14T07:50:48+00:00Added an answer on May 14, 2026 at 7:50 am

    A long time ago in a galaxy far, far away… There were no Attributes or compiler support for class metadata, so the developers tried to implement their own. One of the methods our ancestors worked out were to declare Marker Interfaces .

    So, to answer your question: custom attributes are an “evolution” of marker interfaces. You can use both. But note that, if you want to enforce that your object implement specific methods, you are using an interface, plain and simple. That’s how IDisposable works, it forces you to implement a method named Dispose(). [Serializable] (and probably ISerializable on your C++ example) does not force you to implement anything, as the runtime will just read that declaration and do its task (i.e., serialize the object).

    Note that C# also have a ISerializable interface… It is meant to let you write your custom serialization code, which will then be called by the runtime. Note that it is NOT a marker interface nor replacement for the [Serializable] attribute, as you still need to mark your class with the attribute for the serialization to work.

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

Sidebar

Related Questions

No related questions found

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.