Serialization of an object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fperfect13

    #1

    Serialization of an object



    The problem is like this:

    I have a class C1 which has a private field "private Graph graph;"
    accesed by a property(C1.Gra ph). The class Graph is serializable but
    when i pass to a method that serializes a Graph object C1.Graph it
    gives an error saying that C1 isn't serializable. The project the
    contains the C1 class has a reference to the project with Graph
    class.(the proj with Graph class has no references to C1's class proj).
    The serialization is binary to memstream and back (to make a deep
    copy). Why would the compiler want to serialize the C1 class?

  • Bob Powell [MVP]

    #2
    Re: Serialization of an object

    Does the graph contain a "Parent" reference to the C1 class? I expect this
    is the case. These sorts of common reference serialization problems can
    sometimes be overcome using the memento pattern.

    --
    Bob Powell [MVP]
    Visual C#, System.Drawing

    Find great Windows Forms articles in Windows Forms Tips and Tricks


    Answer those GDI+ questions with the GDI+ FAQ


    All new articles provide code in C# and VB.NET.
    Subscribe to the RSS feeds provided and never miss a new article.





    "fperfect13 " <feugen@gmail.c om> wrote in message
    news:1115645860 .717832.314620@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    >
    >
    > The problem is like this:
    >
    > I have a class C1 which has a private field "private Graph graph;"
    > accesed by a property(C1.Gra ph). The class Graph is serializable but
    > when i pass to a method that serializes a Graph object C1.Graph it
    > gives an error saying that C1 isn't serializable. The project the
    > contains the C1 class has a reference to the project with Graph
    > class.(the proj with Graph class has no references to C1's class proj).
    > The serialization is binary to memstream and back (to make a deep
    > copy). Why would the compiler want to serialize the C1 class?
    >[/color]


    Comment

    • fperfect13

      #3
      Re: Serialization of an object

      Thanks,
      It was actualy a MulticastDelega te of an object inside Graph class to
      C1 class.

      Comment

      Working...