C# Powershell commandlet在方法中编写代码

C# Powershell commandlet在方法中编写代码,c#,powershell,metaprogramming,asp.net-mvc-scaffolding,C#,Powershell,Metaprogramming,Asp.net Mvc Scaffolding,我一直在编写几个powershell函数来自动生成ASP.NET MVC 4的代码,我使用的是来自的cmdlet,它们非常有用,但缺少一点,我希望能够在方法中编写代码。例如,我使用以下方法在类中编写代码: $class = Get-ProjectType Product Add-ClassMember $class "public string Description { get; set; } " 上面的命令工作正常,但代码进入类范围,我想将其放在一个特定的方法中,例如类构造函数。我也有同样

我一直在编写几个powershell函数来自动生成ASP.NET MVC 4的代码,我使用的是来自的cmdlet,它们非常有用,但缺少一点,我希望能够在方法中编写代码。例如,我使用以下方法在类中编写代码:

$class = Get-ProjectType Product
Add-ClassMember $class "public string Description { get; set; } "

上面的命令工作正常,但代码进入类范围,我想将其放在一个特定的方法中,例如类构造函数。

我也有同样的问题。你找到解决办法了吗?嗨,纳泽米安,没有,我没有找到任何解决办法。