Je sais qu'il y a des cours sur ça sur le site mais je n'ai pas trop compris comment régler mon souci...

En fait, je n'arrive pas à passer un objet en DataMember. Lorsque je met DataMember devant la déclaration de mon objet (dans ce cas o_Zone), Visual Studio me fait une exception de type CommunicationFaultedObjectException. Si j'enlève le DataMember, aucun souci, tout se passe normalement. J'aimerais passé cet objet en DataMemeber et je ne vois pas comment régler cette exception. Pour vous aider à m'aider, je donne le morceau de code concerné:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Imports System.Runtime.Serialization
 
<DataContract()> _
    Public Class VilleData
    <DataMember()> Private i_Numero As Integer
    <DataMember()> Private s_CP As String
    <DataMember()> Private s_Nom As String
 
    <DataMember()> Private o_Zone As Zone
 
    Public Event NumeroChanged(ByVal sender As VilleData)
    Public Event CPChanged(ByVal sender As VilleData)
    Public Event NomChanged(ByVal sender As VilleData)
    Public Event ZoneChanged(ByVal sender As VilleData)
 
    Public Sub New(ByVal TheNumero As Integer, ByVal TheCP As String, ByVal TheNom As String, ByVal TheZone As Zone)
        i_Numero = TheNumero
        s_CP = TheCP
        s_Nom = TheNom
        o_Zone = TheZone
    End Sub
 
    Public Property Numero() As Integer
        Get
            Return i_Numero
        End Get
        Set(ByVal value As Integer)
            If i_Numero = value Then Exit Property
            i_Numero = value
            RaiseEvent NumeroChanged(Me)
        End Set
    End Property
 
    Public Property CP() As String
        Get
            Return s_CP
        End Get
        Set(ByVal value As String)
            If s_CP = value Then Exit Property
            s_CP = value
            RaiseEvent CPChanged(Me)
        End Set
    End Property
 
    Public Property Nom() As String
        Get
            Return s_Nom
        End Get
        Set(ByVal value As String)
            If s_Nom = value Then Exit Property
            s_Nom = value
            RaiseEvent NomChanged(Me)
        End Set
    End Property
 
    Public Property Zone() As Zone
        Get
            Return o_Zone
        End Get
        Friend Set(ByVal value As Zone)
            If o_Zone Is value Then Exit Property
            o_Zone = value
            RaiseEvent ZoneChanged(Me)
        End Set
    End Property
 
    ' Désérialisation
    Public Sub New()
    End Sub
End Class
Merci d'avance...