In a netstandard 2.0
application, I have the following method that is part of a static class:
public static class Argument
{
/// <param name="inst">Inst.</param>
/// <param name="instName">Inst name.</param>
/// <exception cref="ArgumentException">
/// Thrown if :
/// <paramref name="inst" /> is not specified in a local time zone.
/// </exception>
public static void ThrowIfIsNotLocal(in DateTime inst, string instName)
{
if (inst.Kind != DateTimeKind.Local)
throw new ArgumentException(instName, $"{instName} is not expressed in a local time-zone.");
}
}
In my program that is running .netcore 2.0
, I have the following line that generates an error:
Argument.ThrowIfIsNotLocal(DateTime.Now, "timestamp");
argument is value while parameter is declared as in
Why is DateTime.Now
causing the error to appear?
Argument
? – Periscope