What is the string equivalent of the following modelbindingcontext int.parse code below?
int myint = int.Parse(valueProvider.GetValue("MyId").AttemptedValue);
Would like to use string.Parse … but not defined
string mystring = string.Parse(valueProvider.GetValue("MyName").AttemptedValue);
The quick and easy answer is that
AttemptedValueis already a string. So I’m not sure what the point of parsing it or callingToString()on it is.The more correct way of doing both this and your
intscenario is to use theConvertTo()method of theValueProviderResult.