int vote;
Insertvotes(objectType, objectId , vote, userID); //calling
For this method call, I want to convert vote
to a bool
. How can I convert it?
Here is the method signature:
public static bool Insertvotes(int forumObjectType,
int objectId,
bool isThumbUp,
int userID)
{
// code...
}
You can try something like
Insertvotes(objectType, objectId , (vote == 1), userID); //calling
Assuming that 1 is voted up, and 0 is voted down, or something like that.
To go from int to boolean
bool isThumbsUp = Convert.ToBoolean(1); //Will give you isThumbsUp == true
To go from boolean to int
int isThumbsUp = Convert.ToInt32(false); //Will give you isThumbsUp == 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With