Return overload fails

后端 未结 4 1333
独厮守ぢ
独厮守ぢ 2021-01-20 01:34

I\'m following this little write up: https://github.com/Readify/Neo4jClient/wiki/cypher but I\'m doing it from Powershell. so what I have so far is

[System.         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-20 02:04

    I know this is not exactly what you're asking, and might not even be what you want, but you could create your own C# class right inside PowerShell using Add-Type. It might be easier to implement it that way and provide simple methods you can use within the PowerShell code if what you're writing relies on a lot of C#-specific things.

    This example is taken straight from the link above:

    $source = @"
    public class BasicTest
    {
      public static int Add(int a, int b)
      {
        return (a + b);
      }
      public int Multiply(int a, int b)
      {
        return (a * b);
      }
    }
    "@
    Add-Type -TypeDefinition $source
    [BasicTest]::Add(4, 3)
    $basicTestObject = New-Object BasicTest
    $basicTestObject.Multiply(5, 2)
    

提交回复
热议问题