C# experts! Can you invoke a function from termina...
# sst
f
C# experts! Can you invoke a function from terminal directly?
Copy code
// Function.cs

namespace SampleFunction
{
    public class Function
    {
        
        public string FunctionHandler(string input, ILambdaContext context)
        {
            return input?.ToUpper();
        }
    }
}
ie. I want to invoke 
FunctionHandler
 from my terminal
t
I think c# works similarly to go where it needs a
Main
entry point and aws provides a wrapper to point it to a function
f
I see, and in the wrapper, how do you load a class dynamically?
Copy code
class Program
{
    static void Main(string[] args)
    {
       // load SampleFunction.Function here
       SampleFunction.Function.FunctionHandler();
    }
 }
t
I'm not sure if this is the best way but the c# std library does have the ability to dynamically load + compile code
f
When I call the wrapper, the
SampleFunction.dll
should already be built. So just dynamically load I think 🤔
t
Ah it's already built in which case you can use the
Assembly
module to load it
c# is how I got started programming but haven't touched it since like 2015
f
Lol life saver! Lemme try that out. Saw that earlier.. and it looked a bit scarier than a
require("SampleFunction")
lol
t
I think this includes a bunch of static typing things but c# does support a
dynamic
keyword so might be able to pass through untyped things
j
So it turns out the “C# expert” @Frank was looking for was really @thdxr 😂
f
… also my TS mentor 🤷‍♂️
t
I only know TS because it's the same language as c# lol