gpt4 book ai didi

c# - 获取数组长度

转载 作者:行者123 更新时间:2023-11-30 18:52:24 25 4
gpt4 key购买 nike

所以我得到了这门课:

    public class MyClass{
public int[] myArray = new int[9];
}

我可以在不需要初始化 MyClass 实例的情况下获取数组的长度吗?

最佳答案

without the need of initializing an instance of MyClass

没有。 = new int[9] 被移动到构造函数,它仅在您实例化该类时运行。

关于c# - 获取数组长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28988056/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com