System.Int32[] 显示而不是数组元素 [英] System.Int32[] displaying instead of Array elements

查看:28
本文介绍了System.Int32[] 显示而不是数组元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图显示数组元素但总是得到这个输出 System.Int32[]而不是整数元素.

I am trying to display array elements but always getting this output System.Int32[] instead of integer elements.

using System.IO;
using System;

class Test
{
    public static void Main()
    {
        int[] arr=new int [26];
        for(int i = 0; i < 26; i++)
        arr[i] = i;

        Console.WriteLine("Array line : "+arr);
    }
}

推荐答案

您可以使用 string.Join

 Console.WriteLine("Array line : "+ string.Join(",", arr));

这篇关于System.Int32[] 显示而不是数组元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆