C#: Versuchen Sie zu überprüfen, welchen Typ ein Objekt ist. Gibt es eine Methode wie TryParse, die einen Objekttyp anniC#

Ein Treffpunkt für C#-Programmierer
Anonymous
 C#: Versuchen Sie zu überprüfen, welchen Typ ein Objekt ist. Gibt es eine Methode wie TryParse, die einen Objekttyp anni

Post by Anonymous »

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

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post