Forum Discussion

frank_guarino_murata_com's avatar
1 year ago
Solved

How to pass a C# list variable to another C# method?

When one calls a method, generally the AML is passed. Is there a way to pass a C# variable so I won't have to regex a string that it casts into when I pass it as I do currently in an AML tag attribut...
  • christopher_gillis's avatar
    christopher_gillis
    1 year ago

    Ah, I see. Unfortunately, no, there's no way to preserve that kind of data-typing.

    However, there are plenty of utility functions to easily convert lists to and from strings nowadays. It is extra code to handle the AML layer, but one line of

    List<string> idList = this.getProperty("selected_ids", "").Split(",").ToList();

    should be enough to handle what you're looking for. And you can use the methodology from the blog post I linked to set this "fake" selected_ids property when you call this C# method.