C# int与char或string拼接

Posted kingbook

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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,
    
                           

以上是关于C# int与char或string拼接的主要内容,如果未能解决你的问题,请参考以下文章