Bonjour,

J'ai un soucis avec une structure en tant que membre d'une classe.
J'ai le code suivant :
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
 
    public struct OrientationData
    {
        public string orientationBasePlate { get; set; }
        public double orientationXRot { get; set; }
        public double orientationYRot { get; set; }
        public double orientationZRot { get; set; }
    }
 
    public class RPA_AssemblyData
    {
        private OrientationData _orientationData;
 
        public OrientationData OrientData
        {
            get
            {
                return _orientationData;
            }
 
            set
            {
                _orientationData = value;
            }
        }
....
    }
Et quand je tente d'affecter une valeur à l'un des champs de la structure de la manière suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
RPA_AssemblyData rpa_dat = new AssemblyData();
rpa_dat.OrientData.orientationBasePlate = "";
j'ai une erreur "Error CS1612 Cannot modify the return value of 'RPA_AssemblyData.OrientData' because it is not a variable"

Une explication ?