草庐IT

ContextStaticAttribute

全部标签

c# - ContextStaticAttribute 到底是什么?

来自documentation:AstaticfieldmarkedwithContextStaticAttributeisnotsharedbetweencontexts.Iftheindicatedstaticfieldisaccessedonadifferentcontext,itwillcontainadifferentvalue.Usethisattributeasitis,anddonotderivefromit.Thefollowingexampleshowsthesyntaxofthisattribute:[ContextStatic]staticintf=7;不幸的是