Confused about how C# struct work -


i have struct

public struct card {     picturebox picture;     double value; } 

i want make array of that, , add/remove pictures , value go on. i'm not able

card[] c = new card[13]; c[1].value = 4;  

how assign, read, , chance values of those?

make value public.

public double value; 

by default, class/struct level elements private, makes inaccessible.

it recommended capitalize public elements, , use properties instead of fields, using following better:

public double value { get; set; } 

you may want consider making struct class, not fit. (see when use struct?, of time working classes in c#) use dictionary of picture's , values:

public dictionary<picture, double> cards;


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -