Microsoft.AspNetCore.Components.Forms.InputSelect`1.TryParseValueFromString(String value, TValue& result, String& validationErrorMessage)
public class InputSelectNumber<T> : InputSelect<T>
{
protected override bool TryParseValueFromString(string value, out T result, out string validationErrorMessage)
{
if (typeof(T) == typeof(int))
{
if (int.TryParse(value, out var resultInt))
{
result = (T)(object)resultInt;
validationErrorMessage = null;
return true;
}
else
{
result = default;
validationErrorMessage = "The chosen value is not a valid number.";
return false;
}
}
else
{
return base.TryParseValueFromString(value, out result, out validationErrorMessage);
}
}
}
Also in C#:
- c# razor add disabled to button if
- add spaces between words unity
- or in unity
- unity custom update
- c# post request
- internal c#
- unity rotate vector
- wpf use enum description
- asp.net core 3.1: cast jObject to dictionary<string,string>
- how to locate a specific element in a list c#
- what is using static in c#
- convert string to decimal c#
- parsing string to int without format exception c#
- unity simple fps controller
- check if two timespans intersect c#
- how to reference scripts in other scenes unity
- c# clone stream
- can't add an editor script
- download file from url asp net web api c#
- how to convert iformfile to byte array c#
- change textbox location C#
- sending email using c#
- unity3d get component
- c# round to closest multiple