Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

128 lines
6.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Type Name="CodeDefaultValueExpression" FullName="System.CodeDom.CodeDefaultValueExpression">
<TypeSignature Language="C#" Value="public class CodeDefaultValueExpression : System.CodeDom.CodeExpression" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit CodeDefaultValueExpression extends System.CodeDom.CodeExpression" />
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.CodeDom.CodeExpression</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
</Attribute>
</Attributes>
<Docs>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>A <see cref="T:System.CodeDom.CodeDefaultValueExpression" /> can be used to represent a reference to a default value.</para>
<para>The <see cref="P:System.CodeDom.CodeDefaultValueExpression.Type" /> property specifies the reference to the value type. The <see cref="T:System.CodeDom.CodeDefaultValueExpression" /> class is used in the generation of generics-based code. For more information on generics, see <format type="text/html"><a href="afdd5477-6770-4686-8297-f58a4d749daf">Generics in the Base Class Library</a></format>. The following code steps are provided in this section to further describe the use of the <see cref="T:System.CodeDom.CodeDefaultValueExpression" /> class to add a new default value to a code graph. </para>
<para>The code in part 1 is part of a larger example provided for the <see cref="T:System.CodeDom.CodeTypeParameter" /> class. This code, when run through the C# code generator, results in the C# code that appears in part 2. When this code is called in the statement in part 3, the result is the output shown in part 4.</para>
<code>// Part 1: Code to create a generic Print method.
CodeMemberMethod printMethod = new CodeMemberMethod();
CodeTypeParameter sType = new CodeTypeParameter("S");
sType.HasConstructorConstraint = true;
CodeTypeParameter tType = new CodeTypeParameter("T");
sType.HasConstructorConstraint = true;
printMethod.Name = "Print";
printMethod.TypeParameters.Add(sType);
printMethod.TypeParameters.Add(tType);
printMethod.Statements.Add(ConsoleWriteLineStatement(
new CodeDefaultValueExpression(new CodeTypeReference("T"))));
printMethod.Statements.Add(ConsoleWriteLineStatement(
new CodeDefaultValueExpression(new CodeTypeReference("S"))));</code>
<para> </para>
<code>// Part 2: Code generated by code in part 1.
public virtual void Print&lt;S, T&gt;()
where S : new()
{
Console.WriteLine(default(T));
Console.WriteLine(default(S));
}</code>
<para> </para>
<code>// Part 3: Call to the generated method.
dict.Print&lt;System.Decimal, int&gt;();</code>
<para> </para>
<code>// Part 4: Output of the generated method.
0
0
</code>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Represents a reference to a default value.</para>
</summary>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CodeDefaultValueExpression ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the <see cref="T:System.CodeDom.CodeDefaultValueExpression" /> class. </para>
</summary>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CodeDefaultValueExpression (System.CodeDom.CodeTypeReference type);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.CodeDom.CodeTypeReference type) cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="type" Type="System.CodeDom.CodeTypeReference" />
</Parameters>
<Docs>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the <see cref="T:System.CodeDom.CodeDefaultValueExpression" /> class using the specified code type reference.</para>
</summary>
<param name="type">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.CodeDom.CodeTypeReference" /> that specifies the reference to a value type.</param>
</Docs>
</Member>
<Member MemberName="Type">
<MemberSignature Language="C#" Value="public System.CodeDom.CodeTypeReference Type { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.CodeDom.CodeTypeReference Type" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.CodeDom.CodeTypeReference</ReturnType>
</ReturnValue>
<Docs>
<value>To be added.</value>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Gets or sets the data type reference for a default value.</para>
</summary>
</Docs>
</Member>
</Members>
</Type>