What is the best way to initialize a struct to a specific value. For example, in C++, I was able to use ZeroMemory(...), or memset. Are there any similar methods in C#?
LA
Printable View
What is the best way to initialize a struct to a specific value. For example, in C++, I was able to use ZeroMemory(...), or memset. Are there any similar methods in C#?
LA
Any primitive members in a C# struct will automatically be set to their default value - usually 0. If you have other needs, you must define a constructor that takes at least one argument and do your initialization in there.