【问题标题】:Meaning of new[] { } in c#c#中new[] {}的含义
【发布时间】:2014-08-15 04:21:09
【问题描述】:

这段代码中“new[] {}”是什么意思?

public Cube(Game game) : base(game)
{
    vertices = Buffer.Vertex.New(
        game.GraphicsDevice,
        new[]
            {
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, -1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, 1.0f), Color.OrangeRed),
            });
}

【问题讨论】:

标签: c#


【解决方案1】:

只需创建一个隐式类型数组,在您的代码中它是一个带有两个元素的 VertexPositionColor[]。

【讨论】:

    猜你喜欢
    • 2015-05-16
    • 1970-01-01
    • 2013-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-19
    • 2011-05-08
    相关资源
    最近更新 更多