C# how can I preserve data between class instances?

前端 未结 2 1004
余生分开走
余生分开走 2021-01-17 02:31

Apologies for the vague title, but I am not really sure how else to explain it.

Given Class A, B and C.

If Class A contains a List, how can I preserve the da

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 03:01

    Use static as defined here: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/static

    Then you will be able to access the class properties instead of instance properties.

提交回复
热议问题