Click here to Skip to main content
15,909,498 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
The problem is that I want to use this Entity in UserConcol like Property; I have a problem with List. For information, I put [Serializable] on LienNoeud List.

This is my entity:
C#
[Serializable]
public class NoeudEntity
{
    private RectangleNode m_Noeud = new RectangleNode();
    private String m_Nom;
    private String m_NoeudID;
    private List<LienEntity> m_LienNoeud;
    private EEtat m_Etat = new EEtat();

    public NoeudEntity()
    {
        m_LienNoeud = new List<LienEntity>();
    }

    public RectangleNode Noeud
    {
        get { return m_Noeud; }
        set { m_Noeud = value; }
    }

    public EEtat Etat
    {
        get { return m_Etat; }
        set { m_Etat = value; }
    }

    public List<LienEntity> LienNoeud
    {
        get { return m_LienNoeud; }
        set { m_LienNoeud = value; }
    }

    public String Nom
    {
        get { return m_Nom;}
        set { m_Nom = value;}
    }

    public String NoeudID
    {
        set { m_NoeudID = value; }
        get { return m_NoeudID; }
    }
}

It is my Property in my UserControl:
C#
public NoeudEntity Noeud
{
    set { m_Noeud = value; }
    get { return m_Noeud; }
}


[I moved your fake answer here instead of simply deleting it.]

Hi guys,
I come back on my problem because I'm not finding the answer but I think
that came from the List in my Entity (it is [Serializable]). The error is:
Object of type 'System.Collections.Generic.List`1[LienEntity]'
cannot be converted to type
'System.Collections.Generic.List`1[LienEntity]'.

I need your help
Thanks
jerem
Posted
Updated 27-Sep-10 23:53pm
v3
Comments
Henry Minute 27-Sep-10 13:16pm    
OK. So you have a problem. Most of us are good at helping people but none of us are mind readers. What problem are you having?

1 solution

You do not say if the error is on serialization or deserialization or in the designer.

So if it is deserialization.

This sort of error did occur if the version number of your assembly changed between serialization and deserialization. i.e. you serialize, then do a build, then deserialize.

Although I thought that the problem had been resolved.

The way to test this is to run your app, close it, then run it again. If you still get the error then this is not the problem.

If you don't get the error then run your app, close it, do a build, run it again. If you get the error then this is the most likely cause.

The solution is to have a fixed version number. (In AssemblyInfo.cs ensure that the version number looks like 1.0.1.0 rather than 1.0.1.*.
Obviously your numbers might be different from above example, the important thing is that there are no asterisks.

If it is in the designer, this[^] might help.
 
Share this answer
 
Comments
JeremH 28-Sep-10 8:19am    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900