Nullable Array Notation

When we put ? after reference type we allow the instance to be null. So we have

  • string?[] – string array where we allow the items to be null (but array itself can’t be null)
  • string[]? – string array which can be null itself (but it can’t have null items)
  • string?[]? – both array and its items allowed to be null

Leave a Comment