Add-Type: Add CSharpVersion4 and CSharpVersion5 to the list of languages supported in the Language parameter
Votes from Connect: 10
Original Date Submitted: 5/9/2013 12:57:09 AM
Handle: Kirk Munro
Site Name: PowerShell
Feedback ID: 786596
Frequency: Always Happens
Regression: Yes, this happens in all previous versions
In PowerShell 3 you cannot use Add-Type to compile C# code written using CSharp 4.0. Nor can you compile C# code written using CSharp 5.0. The highest version available in the Language parameter is CSharpVersion3.
Please add CSharpVersion4 and CSharpVersion5 support to Add-Type so that it is keeping up with the times.
Product Studio item created by Connect Synchronizer due to creation of feedback ID 786596 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=786596).
Try to use Add-Type to define C# classes with code that requires C# 4.0 or C# 5.0. A simple example is a class with methods that have optional parameters with default values.
You should be able to do this.
Internal BugId: 4204