anonymous object dynamic keyword solution

suggest change

You can return an anonymous object from your function

public static object FunctionWithUnknowReturnValues ()
{
    /// anonymous object
    return new { a = 1, b = 2 };
}

And assign the result to a dynamic object and read the values in it.

/// dynamic object
dynamic x = FunctionWithUnknowReturnValues();

Console.WriteLine(x.a);
Console.WriteLine(x.b);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents