Declaration of Anonymous types List

Is there any way to declare a list object of anonymous type. I mean List<var> someVariable = new List<var>(); someVariable.Add( new{Name="Krishna", Phones = new[] {"555-555-5555", "666-666-6666"}} ); This is because I need to create a collection at runtime. Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may … Read more

Calling async methods from non-async code

I’m in the process of updating a library that has an API surface that was built in .NET 3.5. As a result, all methods are synchronous. I can’t change the API (i.e., convert return values to Task) because that would require that all callers change. So I’m left with how to best call async methods in a synchronous way. This is in the context of ASP.NET 4, ASP.NET Core, and .NET/.NET Core console applications.