I created the below class with constant properties so I can use it as sort of enum.
public class Interval
{
public const string FiveMinutes = "5m";
public const string FifteenMinnutes = "15m";
public const string OneDay = "1d";
public const string OneWeek = "1wk";
public const string OneMonth = "1mo";
}
The content of the method expects Interval
.
public IRestResponse GetSpark(string Symbol, Interval Interval)
{
var url = $"https://...?interval={Interval}";
return RestAPI.RestCall(url);
}
When using Interval.OneWeek
I get the error 'CS1503: Argument 2: cannot convert from 'string' to 'class.Enum.Interval'.'
var foo = new fooClass();
var fooMethod = fooClass.GetInfo("Example", Interval.OneWeek);
Why do I get this error and how to resolve it?