Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. > var arr = new[] { 1.5,2.0 };
  2. arr = { 1.5, 2.0 }
  3. > var sum = arr.Sum();
  4. sum = 3.5
  5.  
  6. private static void Main(string[] args)
  7. {
  8. // Call the PowerShell.Create() method to create an
  9. // empty pipeline.
  10. PowerShell ps = PowerShell.Create();
  11.  
  12. // Call the PowerShell.AddScript(string) method to add
  13. // some PowerShell script to execute.
  14. ps.AddScript("$arr = 1.5,2.0"); # Execute each line read from prompt
  15.  
  16. // Call the PowerShell.Invoke() method to run the
  17. // commands of the pipeline.
  18. foreach (PSObject result in ps.Invoke())
  19. {
  20. Console.WriteLine(result.ToString());
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement