Skip to content

Nullability: flow analysis with array creation #1243

Closed
@jnm2

Description

@jnm2

Would it be a good thing to mention that a compiler may treat a newly created array as though it was already initialized with non-null values, even though it was not?

var array = new string[10];
_ = array[0].Length; // No warning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions