<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Anonymous type - Page 3 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=Anonymous_type&amp;p=2">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Anonymous_type&amp;p=4">3.Next</a>
</p>
<p><a href="page.php?w=dynamic_typing">dynamic typing</a>. While anonymous types allow programmers to define fields seemingly "on the fly," they are still static entities. Type checking is done at compile time, and attempting to access a nonexistent field will cause a compiler error. This gives programmers much of the convenience of a dynamic language, with the type safety of a <a href="page.php?w=static_typing">statically typed language</a>.</p>

<p><big>Examples</big></p>
<p><big>C#</big></p>
<p><syntaxhighlight lang="csharp">var person = new { firstName = "John", lastName = "Smith" };Console.WriteLine(person.lastName);</syntaxhighlight>Output:</p><p>
<a accesskey="1" href="page.php?w=Anonymous_type&amp;p=2">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Anonymous_type&amp;p=4">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
