Can you change the value of a variable while debugging a C# application?

Posted on 2006-05-04
Last Modified: 2008-02-26
Can you change the value of a variable while debugging a C# application?
Question by:chuang4630
    LVL 69

    Accepted Solution

    Hi chuang4630,

    of course you can from the Locals window or the Watch window or the Immediate window or ...

    LVL 12

    Assisted Solution

    and that is temporarily.  if you try to put a breakpoint and then modify code, then you will have to restart execution to see the change

    for watch window right click on code then quick watch then type over the value
    for Immediate window type
    someval = something  (depending on type you are assinging to) example textbox

    TextBox1.Text = "Hello";
    LVL 4

    Assisted Solution

    It seems that you can change the value when debugging, however the process will not be effected by you new value. You need to Restart Debug Process. That's the way. Hope to hear your idea
    LVL 13

    Expert Comment

    Look like we are going to answer homework question for a student :D

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Article by: Ivo
    C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now