DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Wally McClure Guest

    converting to csharp from vb questions

    Hi all. I am converting some test code from VB to C#. I am looking for the
    c# equivalents of ByVal/ByRef and DoEvents. I am not sure that DoEvents
    still makes sense with WinForms, but I thought I would at least ask.

    Wally



  2. #2
    Mattias Sjögren Guest

    Re: converting to csharp from vb questions

    Wally,

    >I am looking for the c# equivalents of ByVal/ByRef


    The default behaviour is to pass parameters by value, so you don't
    have to do anything for that. To pass by reference, use the ref
    keyword, both in the parameter declaration and in the calling code.

    int foo(ref int bar) { ... }

    foo(ref myInt);


    >and DoEvents. I am not sure that DoEvents
    >still makes sense with WinForms, but I thought I would at least ask.


    System.WinForms.Application.DoEvents();


    Matt

    ====================================
    Mattias Sjögren - mattias @ mvps.org
    http://www.msjogren.net/dotnet/

    CodeHound - The Software Developer's Search Engine
    http://www.codehound.com

  3. #3
    Wally McClure Guest

    Re: converting to csharp from vb questions

    Thanks,

    Wally

    "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
    news:3a993d0f.204512914@news.devx.com...
    > Wally,
    >
    > >I am looking for the c# equivalents of ByVal/ByRef

    >
    > The default behaviour is to pass parameters by value, so you don't
    > have to do anything for that. To pass by reference, use the ref
    > keyword, both in the parameter declaration and in the calling code.
    >
    > int foo(ref int bar) { ... }
    >
    > foo(ref myInt);
    >
    >
    > >and DoEvents. I am not sure that DoEvents
    > >still makes sense with WinForms, but I thought I would at least ask.

    >
    > System.WinForms.Application.DoEvents();
    >
    >
    > Matt
    >
    > ====================================
    > Mattias Sjögren - mattias @ mvps.org
    > http://www.msjogren.net/dotnet/
    >
    > CodeHound - The Software Developer's Search Engine
    > http://www.codehound.com




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links