Cannot take the address of, get the size of, or declare a pointer to a managed type ('type name')

后端 未结 3 620
傲寒
傲寒 2021-01-20 15:56

this error stops compiling if i have one or more System.String in my structs
is there any other way to store strings?

i have tried things like this:

         


        
3条回答
  •  南方客
    南方客 (楼主)
    2021-01-20 16:34

    You can only get the address of a struct if it is blittable, i.e. it doesn't contain references.
    See Blittable and Non-Blittable Types(MSDN)

提交回复
热议问题