[Mono-dev] mono xml
alcherenga alcherenga
alcherenga at gmail.com
Thu Jan 3 01:02:09 EST 2008
Thanks Miguel,
On Dec 29, 2007 11:23 PM, Miguel de Icaza <miguel at novell.com> wrote:
>
>
> > is there any work around for that ? I mean using network stream and
> > then use beginread instead of the normal read() method.
>
> Yes, there is a very simple work around. If you wrap your code in a
> delegate, you can invoke the delegate in async mode.
>
> So essentially, you can turn any sync operation into an async one.
>
> Here is a simple program that shows you how to use BeginInvoke and
> EndInvoke methods (these are automatically generated for all delegates):
>
> using System;
> using System.Threading;
>
> delegate int Worker ();
>
> class X {
> static void Main ()
> {
> Worker w = delegate {
> Console.WriteLine (" Async: sleeping for five
> seconds");
> Thread.Sleep (5000);
> Console.WriteLine (" Async: done");
> return 10;
> };
> Console.WriteLine ("Main thread: Launching async method");
> IAsyncResult r = null;
>
> r = w.BeginInvoke (delegate {
>
> Console.WriteLine (" Async: notification Callback
> invoked, method finished");
> Console.WriteLine (" Async: result from worker
> was: {0}", w.EndInvoke (r));
> }, null);
> Console.WriteLine ("Main thread: waiting for async call to
> finish");
> r.AsyncWaitHandle.WaitOne ();
> Console.WriteLine ("Main thread: finishing");
> }
> }
>
> > the second question is based on an article written in msdn,
> > xmltextreader cannot read file above 2GB. why is this limititation
> > imposed when it is a forward only reader. or is there any such
> > limitation imposed by mono's implementation of the same.
>
> I do not know that there is any limitation in our implementation, let us
> know what you find out.
>
> Miguel
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080103/1461e052/attachment.html
More information about the Mono-devel-list
mailing list