I need to use an array inside the C# struct. my part of the code is as follows,
This is how I defined Struct.
struct customerParameter
{
public const string value1 = "zero";
public const string value2 = "one";
public const string value3 = "theree";
public const string[] multivalues = { "india", "china", "japan" };
}
But above code makes a compile-time errors,
The expression being assigned to 'customerParameter.multivalues' must be constant.
I added the above array in a struct, I need to do the following sample code thing. I need to check if the array consists of the customerInput or not. What is the best way to handle this? how can I use Struct with Array to do this?
static void Main(string[] args)
{
var customerInput = Console.ReadLine();
if (customerInput == customerParameter.value1)
{
//do something
}
if (customerParameter.multivalues.Contains(customerInput))
{
//my code
}
}