The property of anonymous type is inferred from the expression.
using System;
class Test
{
static void Main()
{
string FirstName = "J";
var person = new { FirstName };
// var person = new {FirstName = "J"};
Console.WriteLine(person.FirstName);
}
}
The output:
J
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |