Hello to all! The task is simple, in c ++ it is clear how it is implemented. But how to do this in C #, I still do not understand:

There is a set of variables of type struct. It is necessary to make so that each element of the array is assigned to the 1st variable from this set. How to do it?

This is approximately how it looks in C ++:

struct STR *a[3]; struct STR d, g, f; a[0] = &d; a[1] = &g; ... 
  • Why exactly struct ? - awesoon
  • Because they are copied completely. The class itself only copies the link. Hmmm, then class can do) - Alerr
  • Ah, no, I can't class ... I work with Unity, the trouble is that the struct is needed - Alerr
  • 2
    Maybe you clarify a question by reformatting it in a question on Unity and including the necessary information? I am sure there is a solution to your problem. - andreycha

1 answer 1

No

In C #, a structure is a type-value, the same as the constant 5. You can't get the address of the constant 5 itself, right? When passed to another method, the value is not transferred, but copied.

Do not try to write in C # the same way as in C ++, these are different languages.