初始化在C#中的任意起始点指数数组 [英] Initializing an array on arbitrary starting index in c#

查看:115
本文介绍了初始化在C#中的任意起始点指数数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#有可能初始化数组,例如,子索引1?

Is it possible in c# to initialize an array in, for example, subindex 1?

我与互操作办公室工作,每一个属性是一个对象数组,在1开始(我假设它在VB.NET原本程序性),并且你不能修改它,你必须为它设置整个阵列接受更改。

I'm working with Office interop, and every property is an object array that starts in 1 (I assume it was originally programed in VB.NET), and you cannot modify it, you have to set the entire array for it to accept the changes.

作为一种变通方法,我克隆原始数组,修改之一,并将其​​设置为当我做了一个整体。

As a workaround I am cloning the original array, modifying that one, and setting it as a whole when I'm done.

不过,我想知道是否有可能创建一个新的非零基于阵列

But, I was wondering if it was possible to create a new non-zero based array

推荐答案

您可以使用的 Array.CreateInstance

You can use Array.CreateInstance.

请参阅.NET

See Array Types in .NET

这篇关于初始化在C#中的任意起始点指数数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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