Equivalent to C#'s “using” keyword in powershell?

By : froh42
Source: Stackoverflow.com

When I use another object in the .net-Framework in C# I can save a lot of typing by using the using directive.

using FooCompany.Bar.Qux.Assembly.With.Ridiculous.Long.Namespace.I.Really.Mean.It;


  var blurb = new Thingamabob();


So is there a way in Powershell to do something similiar? I'm accessing a lot of .net objects and am not happy of having to type

 $blurb = new-object FooCompany.Bar.Qux.Assembly.With.Ridiculous.Long.Namespace.I.Really.Mean.It.Thingamabob;

all the time.

By : froh42


This windows powershell blog posting has an example of how to achieve this

I realize this is an old post, but I was looking for the same thing and came across this: http://weblogs.asp.net/adweigert/powershell-adding-the-using-statement

Edit: I suppose I should specify that it allows you to use the familiar syntax of...

using ($x = $y) { ... }
By : haliphax

the best logical equivilent would be using the "Start-SPAssignment". see in details http://technet.microsoft.com/en-us/library/ff607664(v=office.15).aspx

This video can help you solving your question :)
By: admin