String Array in struct

  • Thread starter Thread starter ZenForAll
  • Start date Start date
Z

ZenForAll

Guest
Hello this works

public struct Temp_t{

public Int32 Zahl;

public UInt32 UZahl;

public string Temp_CPU;

}

This does not

public struct Temp_t
{
public Int32 Zahl;
public UInt32 UZahl;
string[] Temp_CPU = new string[5];
}

gives me

Severity Code Description Project File Line Suppression State
Error CS0573 'Temp_t': cannot have instance property or field initializers in structs ConsoleTempX

Is it possible to declare a string Array in a struct ?

C:\Users\ats37\source\repos\ConsoleTempX\Program.cs 16 Active

Continue reading...
 
Back
Top