无法将类型string隐式转换为int,怎么办?
1个回答
展开全部
你的ClassroomBuilding和 ClassroomStep这两个变量类型都是int类型的,而 buildnum和 floor是string类型的,所以不能这样直接赋值。把这两句改成:
classroom.ClassroomBuilding = int.Parse(buildnum);
classroom.ClassroomStep = int.Parse(floor);
或者将ClassroomBuilding和 ClassroomStep这两个变量类型改成string
classroom.ClassroomBuilding = int.Parse(buildnum);
classroom.ClassroomStep = int.Parse(floor);
或者将ClassroomBuilding和 ClassroomStep这两个变量类型改成string
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询