My first try to use anonymous types(test):
private void button4_Click(object sender, EventArgs e)
{
test(new { a = "asd" });
}
private void test(string a)
{
}
I get an error "cannot convert from 'AnonymousType#1' to 'string' "
Also I'd like to know how to pass an anonymous type if the parameter is a string[]
private void test(string[] a)
{
}
Thanks in advance!
Something about your design is faulty. If your test function accepts only strings, then you can never pass an anonymous type to it, just as you can't pass an int, object, or any other non-string type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With