4
I have a method that gets an integer that can be null, if it happens some executions of methods, but when I will use the same variable in a place that uses int which cannot be null, it appears that the overload is incorrect.
So I wonder how I can make this conversion, is there any method that does it like ToString?
Code with the problem
public HttpResponseMessage Metodo(int? variavel = chamadademetodo.metodo {
if (variavel == null) {
...
}
var bla2= blablabla.metodo(variavel, DataContext); //aqui acusa problema
}
variavel = chamadademetodo.metodothat doesn’t exist.– Maniero
@bigown doesn’t exist, it was just for example
– Paz
I wonder if you really need this
int?there.– Maniero
@accurate mustache, this app is also mobile and if the int is not nullable, it can interfere with the app’s behavior
– Paz
Everything you do can affect how it works, but a lot of things can be done in a better way. Just like you can use
dynamic(in your previous question), there is a better way, this is a case that may have better solution.– Maniero
I understand, maybe there is a better way, but this would involve moving around a lot of places and/or demanding knowledge that I don’t have yet
– Paz