Ask a FAQ Question

Ask a FAQ Question

Rate This

Do you have a FAQ about:

  • The C# Language or compiler
  • The C# IDE
  • The Visual Studio debugger

Reply to this post, and your question will be added to our list to be answered. Of course, depending on the nature of your comment, and the volume we receive, we may not get to every question.

Note that if your question is not about C# specifically (if it is, for example, a Windows Forms question or a general question about the .NET Framework), it would be better to post that question to a newsgroup or web forum. Visit for a listing of related resources.


Leave a Comment
  • Please add 6 and 6 and type the answer here:
  • Post
  • When using a the using statement as below, my form is not releasing the memory aquired when the form is shown.

    The form only has some buttons and labels.

    using (Wizard frmWizard = new Wizard())
    frmWizard.Tag = log;
    } while (frmWizard.Visible);
    frmWizard.Tag = null;


  • Does assigning a variable to null at the end of a routine make any sense? I have inherited some code where this is done alot, and my opinion is that nothing is gained by assigning a variable to null right before it goes out of scope. Could we have some direction on this please?
  • Need to print a form out to a printer.
    Used "Form".PrintForm
    Scaling way out.
    Can I scale? or use a "fit to page" so it automatically scales the form to an A4 sheet?
  • accessibility: Does anybody except myself feel restricted with the Objective-C, C++ or Java inherited "accessibility" declarations (public, private, protected, internal, etc.). In general, if I have one class that needs special access to components in a second, do I have any alternative besides placing the first class in the same program file or re-declaring “public” the internals of the second class (which I may not want to be generally available)?
    --S. Lee Odegard,
  • What is the performance difference betwen using Static members and Instance members.

    E.g. I have a class Admin and a member name GetUser()

    What is the performance difference between



    Admin admin = new Admin();

  • In general web application(ASP.NET) scenario which of the variable will have the application scope for e.g if I read a properties file in a datastructure and keep it as a static variable. Is it the same as storing that variable in an application object.That means it is avaible till I stop IIS.
  • I created a datalist with an edit link button following microsofts guide. Here is a code sample...

    ...<asp:datalist id="IssueDL" runat="server" OnUpdateCommand="IssueDL_OnUpdate" OnCancelCommand="IssueDL_OnCancelCommand" OnEditCommand="IssueDL_OnEditCommand">...

    <asp:linkbutton id="onEditLB" runat="server" commandname="Edit">Edit Issue</asp:linkbutton>...

    When I select the link button it appears to send two clicks to the server, hence my edit event handler is called twice. I have tested this with placing number labels on the page which get incremented by one if the edit event handler is fired. Clicking once on the link button increments the number label by two. I then set up a break point within the edit event handler and it gets hit it twice. If I trace the code through on the second trip I end with the following message dialog box:

    "There is no source code for the current location".

    I did a google on this and found this article on msdn:

    which mentions double-clicking a module. I am not double clicking the edit button but it clearly looks like two clicks are being sent. I looked at all of the system delagate event handlers and they all look right. Does anyone know how to resolve this? (I get the same behavoir with my update and cancel buttons).

  • I have used Microsoft.Samples.WinForms.Extras to present a dialog for my User to browse to and select a folder.

    This works fine, first time the User needs to browse the default path is set to "My Computer".

    However, the User may need to browse to the same location a number of times and what I would like the dialog to do next time around therefore is to start at the folder previously browsed to. How can I "seed" the dialog to do this?

  • I seem to remember somewhere someone made the comment that you should be careful when deciding to use static functions/fields in classes. I know that a lot of developers use static fields/methods as globally available fields/methods. Is this a good practice? What should you watch out for when using static fields/methods? Are static fields sometimes shared across AppDomains? Are there any threading issues with static fields/methods?
  • How do I access a serial port using C#?
  • What advantages (such as speed), if any, are there to using readonly on private fields that only get assigned in the constructor?
  • In VB6 MTS was used to handle transactions. How are transactions carried out by C#?
  • How exactly does Visual Studio .NET integrate with NANT for doing builds? Any information would be appreciated.
  • How exactly does Visual Studio .NET integrate with NANT for doing builds? Any information would be appreciated.
  • Why C# does only support nameless indexers?
    What about virtual constructors and class references? Is there any danger related to these features? I'm a Delphi programmer moving to C#, and I find class references and virtual constructors very useful to implement the factory pattern.
Page 4 of 14 (208 items) «23456»