Does the latest version of Powershell have the ability to do something like JavaScript’s:
var point = new Object(); point.x = 12; point.y = 50;
If not, what is the equivalent or workaround?
UPDATE
Read all comments
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The syntax is not directly supported by the functionality is there via the add-member cmdlet’s. Awhile ago, I wrapped this functionality in a general purpose tuple function.
This will give you the ability to one line create these objects.
Here is the code for New-Tuple
Blog Post on the subject: http://blogs.msdn.com/jaredpar/archive/2007/11/29/tuples-in-powershell.aspx#comments