I have a variable, Chunks, that is marked as { protected set; get; }
. I want to mark this variable as NonSerialized
so it won't be saved when I serialize the object that contains it.
However, I get the following error when I try this:
CS0592: Attribute 'NonSerialized' is not valid on this declaration type. It is valid on 'field' declarations only.
Here's the code I have:
[NonSerialized] public Chunk[,]? Chunks
{
protected set;
get;
}
Is Chunk
not a field? If so, what is it and how can I replicate the NonSerialized
property on my variable?