Is it possible to refer to a property of an anonymous object in its initializer?

Hi,

Is there a way to do something like this:

var v = new { Amount = 108, Message = "Hello " + Amount }; 

I tried this earlier at work and the Amount couldn't be resolved in the "Hello " + Amount expression.

by LamborghiniVeneno via /r/csharp

Leave a Reply