C#: Versuchen Sie zu überprüfen, welchen Typ ein Objekt ist. Gibt es eine Methode wie TryParse, die einen Objekttyp anni
Posted: 22 May 2025, 21:46
Ich arbeite in Einheit an einem Schachspiel.
Code: Select all
object[,] board = memoryBoard.createChessBoard(Piece.starting_pos); //returns a multidimensional array of type object[8,8] which either has a piece or an integer 0
int zero = 0;
Debug.Log(int.TryParse(board[0, 0], out zero)); // obv this is wrong since TryParse requires a string and not an object
//what I want it to return is either true or false depending upon whether my object is of type int or not