2 <clause number="25.5.2" title="Pointer member access">
3 <paragraph>A <non_terminal where="25.5.2">pointer-member-access</non_terminal> consists of a <non_terminal where="14.5">primary-expression</non_terminal>, followed by a "->" token, followed by an identifier. <grammar_production><name><non_terminal where="25.5.2">pointer-member-access</non_terminal></name> : <rhs><non_terminal where="14.5">primary-expression</non_terminal><terminal>-></terminal><non_terminal where="9.4.2">identifier</non_terminal></rhs></grammar_production></paragraph>
4 <paragraph>In a pointer member access of the form P->I, P must be an expression of a pointer type other than void*, and I must denote an accessible member of the type to which P points. </paragraph>
5 <paragraph>A pointer member access of the form P->I is evaluated exactly as (*P).I. For a description of the pointer indirection operator (*), see <hyperlink>25.5.1</hyperlink>. For a description of the member access operator (.), see <hyperlink>14.5.4</hyperlink>. </paragraph>
7 <example>[Example: In the example <code_example><![CDATA[
12 public override string ToString() {
13 return "(" + x + "," + y + ")";
25 Console.WriteLine(p->ToString());
29 ]]></code_example>the -> operator is used to access fields and invoke a method of a struct through a pointer. Because the operation P->I is precisely equivalent to (*P).I, the Main method could equally well have been written: <code_example><![CDATA[
39 Console.WriteLine((*p).ToString());
43 ]]></code_example>end example]</example>