How do I return a Powershell DataTable object from C# app code?
I'm starting to use Powershell for some development projects and plan to integrate it with .NET, namely C#. Being a beginner (1 day so far), I've taken a few examples online and from some books. One thing for now that I couldn't figure out, is how do I return a PowerShell script-made DataTable to C# code.
Can anyone please guide me how to do such? I've taken how to set up the data tables from this site:http://chris开发者_开发百科federico.wordpress.com/2008/06/25/creating-a-datatable-in-powershell, but haven't found a good example how to get the object for C# processing.
Thank you.
This should do it...
System.Management.Automation.PowerShell.Create().AddScript(...).Invoke<DataTable>
Hope this helps
精彩评论