public int getboolean(string str)
{
  if (str=="True")
     return 1;
  else
    return 0;
}

解决方案 »

  1.   

    bool bTrue=true;
    Console.WriteLine(Convert.ToInt16(bTrue));
      

  2.   

    觉得名称改一下比较好记。
    public int bool2str(string str)
    {
      if (str=="True")
         return 1;
      else
        return 0;
    }
      

  3.   

    public int ToInt(bool Result)
    {
        return Result?1:0;
    }
      

  4.   

    好像应该是这样吧!
    public int boolTemp(bool boolTemp)
    {
      if(boolTemp)
         return 1;
      else
         return 0;
    }