• int[] 转object[]


                int[] array ={ 1, 3, 4, 5 };
                object[] o = (object[])System.Collections.ArrayList.Adapter((Array)array).ToArray(typeof(object));
                foreach (object oo in o)
                {
                    Console.WriteLine(oo);
                }

    【lovefootball】:
    int[] array ={ 1, 3, 4, 5 };
                object[] o = new object[array.Length];
                Array.Copy(array, o, array.Length); 
                foreach (object oo in o)
                {
                    Console.WriteLine(oo);
                }

    【lovefootball】:
    object[] o = Array.ConvertAll<int, object>(array, delegate(int input) { return input; });

                foreach (object oo in o)
                {
                    Console.WriteLine(oo);
                }

    微软BI技术交流群:316744959 武汉NET技术群:961108969 NET技术群:21386099 本人具有丰富的系统开发经验,承接系统开发,小程序,NET系统开发,BI开发,有需求联系微信手机:15010195887
  • 相关阅读:
    C# Lambda表达式
    C# LINQ用法
    C# XML介绍及基本操作
    C# 装箱和拆箱
    C# 堆与栈
    C#中ref和out的区别
    C#中16进制string字符串的转16byte互转
    C#中把一个Struct结构转换成Byte[]的方法
    SqlServer中查询操作记录的方法
    asp.net中后台获取Post参数(Json)最简单的一种方法。
  • 原文地址:https://www.cnblogs.com/Impulse/p/1530410.html
Copyright © 2020-2023  润新知