PowerShell:- Datatype – Array – Declaration & Initialization – Bug ? – Patrick Meinecke Response

Background

A quick feedback on our last post.

 

Referenced Work

  1. PowerShell:- Datatype – Array – Declaration & Initialization
    Link

Source Code Control

GitLab

PowerShell – Array – Declaration & Initialization – Sample – nameList
Link

Bug Report

Microsoft

PowerShell

An Uninitialized declared array leads to string concatenation #17313
Link

Feedback

Patrick Meinecke ( SeeminglyScience )

Image

Textual

So the latter isn’t actually declaring anything.
It’s just casting $nameListUnInitialized (which will be null at that time) to string[].
Only the former actually creates a variable, so this behavior is by design.

 

Revised Code

Code

PowerShell – Array – Declaration & Initialization – Sample – nameList
Link

Output

Output – Image

 

Output – Textual

List - $nameListInitialized

Type Name:- String[]
BaseType:- System.Array

1) Joya

2) Tom

3) Kate

Number of entries:- 3

List - $nameListUnInitialized

Type Name:- String
BaseType:- System.Object

1) JoyaTomKate

Number of entries:- 1

Dedication

Crediting Patrick Meinecke.

Lifting up the favored and faithful.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s