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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:09:22+00:00 2026-05-22T21:09:22+00:00

A very simple question… Is it correct to apply a DataMember attribute to an

  • 0

A very simple question…

Is it correct to apply a DataMember attribute to an event or a delegate to let it be serialized?

Consider what I’m thinking about this:

1) Well, a delegate is a type, based on other types, so as long as those types are serializable themselves there is no need (not correct) to serialize a delegate.

2) Given that an event is based on a delegate, and that a delegate (because of what said in 1) does not need direct serialization, I assume an event does not need to be marked as serializable.

So, my question is:

Is it correct applying serialization attributes to events and delagates?

If the answer is “NO! No need to make them serializable”, Are 1) and 2) correct?

Another question: What elements in a class a developer needs to mark as serializable (using DataMember on them)?

Thankyou

  • 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-22T21:09:23+00:00Added an answer on May 22, 2026 at 9:09 pm

    No it is not correct. DataMember can be applied only on property or field – that is defined by AttributeTargets:

    [AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, 
        Inherited = false, AllowMultiple = false)]
    public sealed class DataMemberAttribute : Attribute
    { ... }
    

    AttributeTargets have separate value for Enum and Delegate.

    Serialization delegate or event in distributed system doesn’t make sense. You are passing data in interoperable format. Message can contain only data. There is nothing to describe delegates (object oriented pointer to the method living in your process memory) or events (trigger for delegates living in your process memory).

    If you want to have data contract’s events on your client you must share the assembly with the contract between the service and the client. In such case both sides will have the same type (with all events, methods, readonly properties, etc.) and they will transfer only data stored in an instance of the type.

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

Sidebar

Related Questions

Very simple question about jstl. Consider Map which return by Controller/Servlet. I would like
This is a very simple question, but I can't seem to find something about
I have a very simple question about how CWinThread works and where is the
This is probably a very simple question but I have a confusion about the
Very simple question but all the answer I read over the web doesn't apply.
I have a very simple question about transactions. (In sql server 2000, but I
Very simple question, is there any cloud server enviroments avaliable these days for us
Very simple question, I made the following program : #include <stdlib.h> int main(int argc,
Very simple question. What does the term 'seeding' mean in general? I'll put the
This is a very simple question with a simple answer, but it is not

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.