C# int與char或string拼接


using UnityEngine;
public class Test: MonoBehaviour{
    private void Start (){
		Debug.Log(',');//output:,
		Debug.Log(1+',');//output:45

		int intValue1=1+',';
		Debug.Log(intValue1);//output:45
		//int intValue2=1+",";//無法將類型"string"隱式轉換為"int"

		//string str1=1+',';//無法將類型"int"隱式轉換為"string"
		string str2=1+",";
		Debug.Log(str2);//output:1,
    }
}						    


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM