This time we update csharpxom to adjust it to C# 4.5. Additions are async modifier and await operator.
async
await
They are used to simplify asynchronous programming.
The following example from the msdn:
private async Task<byte[]> GetURLContentsAsync(string url) { var content = new MemoryStream(); var request = (HttpWebRequest)WebRequest.Create(url); using(var response = await request.GetResponseAsync()) using(var responseStream = response.GetResponseStream()) { await responseStream.CopyToAsync(content); } return content.ToArray(); }
looks like this in csharpxom:
<method name="GetURLContentsAsync" access="private" async="true"> <returns> <type name="Task" namespace="System.Threading.Tasks"> <type-arguments> <type name="byte" rank="1"/> </type-arguments> </type> </returns> <parameters> <parameter name="url"> <type name="string"/> </parameter> </parameters> <block> <var name="content"> <initialize> <new-object> <type name="MemoryStream" namespace="System.IO"/> </new-object> </initialize> </var> <var name="request"> <initialize> <cast> <invoke> <static-method-ref name="Create"> <type name="WebRequest" namespace="System.Net"/> </static-method-ref> <arguments> <var-ref name="url"/> </arguments> </invoke> <type name="HttpWebRequest" namespace="System.Net"/> </cast> </initialize> </var> <using> <resource> <var name="response"> <initialize> <await> <invoke> <method-ref name="GetResponseAsync"> <var-ref name="request"/> </method-ref> </invoke> </await> </initialize> </var> </resource> <using> <resource> <var name="responseStream"> <initialize> <invoke> <method-ref name="GetResponseStream"> <var-ref name="response"/> </method-ref> </invoke> </initialize> </var> </resource> <expression> <await> <invoke> <method-ref name="CopyToAsync"> <var-ref name="responseStream"/> </method-ref> <arguments> <var-ref name="content"/> </arguments> </invoke> </await> </expression> </using> </using> <return> <invoke> <method-ref name="ToArray"> <var-ref name="content"/> </method-ref> </invoke> </return> </block> </method>
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u