473,748 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to show the value of a private variable in some debug window? (C# Express)

Let's say I have a Person class with a private int age member variable. I
have a get and set accessor for the Age property. When I am running the code
in debug mode, I would like to have a debug window show me the value of age
(rather than the value of the Age property). Is there a way to do this?

Thanks!
Jun 24 '06 #1
2 2567

Yes, certainly there are ways. For example you have the code similar to
this.

public class Person
{
private Int32 _Age;

public Int32 Age
{
set {
_Age = value;
System.Diagnost ics.Debug.Write (_Age.ToString( ));
}
get {
return _Age;
}
}
}

Check out the line System.Diagnost ics.Debug.Write (_Age.ToString( ));
which prints the value of the _Age in the debug window.

Let us know if you have any trouble in doing this.

-
Vadivel Kumar
http://www.vadivelk.net
Johann Schuler wrote:
Let's say I have a Person class with a private int age member variable. I
have a get and set accessor for the Age property. When I am running the code
in debug mode, I would like to have a debug window show me the value of age
(rather than the value of the Age property). Is there a way to do this?

Thanks!


Jun 24 '06 #2
> prints the value of the _Age in the debug window

Vadivel:

I am using C# Express edition and I cannot get a "debug" window as such.
While running in debug mode, the windows I can get under Debug -> Windows
are: Output, Locals, Watch, Immediate, and Call Stack. None of these windows
will display _Age. Could this be a limitation of the Express edition?

Johann (newbie)

"Vadivel Kumar" <va*****@gmail. com> wrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .

Yes, certainly there are ways. For example you have the code similar to
this.

public class Person
{
private Int32 _Age;

public Int32 Age
{
set {
_Age = value;
System.Diagnost ics.Debug.Write (_Age.ToString( ));
}
get {
return _Age;
}
}
}

Check out the line System.Diagnost ics.Debug.Write (_Age.ToString( ));
which prints the value of the _Age in the debug window.

Let us know if you have any trouble in doing this.

-
Vadivel Kumar
http://www.vadivelk.net
Johann Schuler wrote:
Let's say I have a Person class with a private int age member variable. I
have a get and set accessor for the Age property. When I am running the
code
in debug mode, I would like to have a debug window show me the value of
age
(rather than the value of the Age property). Is there a way to do this?

Thanks!

Jun 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
13480
by: marane moll | last post by:
Hello. How do I write to the debug window in "Visual c++" in a windows application? Thankyou Sincerely Marane
2
9249
by: umashd | last post by:
Hi, I am doing a web based project for my graduation. I studied bit of java for backend processesing and javascript for the client. Here is the scenario. In the FORM, I use INPUT TYPE=text VALUE=" " NAME=cat, and a gif next to it. User will click on the icon to get a new window. In the new window, the user selects a value from the pull down menu (created by servlet from back end) and clicks OK. The value is passed back to the
4
4476
by: Thomas Anderson | last post by:
I would like to replicate the debug window on a form so I can easily pass usefull info to users on long processes. Is there a simple way to do this. thanks
3
8161
by: Mike Turco | last post by:
Is there a way to clear the debug window other than just sending a bunch of line feeds? Tanks -- Mike
3
2155
by: jeko | last post by:
Hi, I'm using a class method which read and write on private variable of own class. During the first alghoritm cycle, method read and write correclty on num_elts variable, but during the second cycle as soon as method wants read (or write) the variable program is aborted and return "segmentation fault". Why? num_elts is a long variable. thanks
5
3000
by: risha | last post by:
void FlashReadM(volatile unsigned long *fl_ad,unsigned long abb) { unsigned long ulvald; abb=2; ulvald=0; //fl_ad=(volatile unsigned long *)0x8020; ulvald= *(fl_ad); //return ucVal; }
7
18796
by: Thomas Pecha | last post by:
Sorry for all who think this is easy, I was not able to handle this Coming from VB6 where with simple debug.print strAString you could write to debug window, I am totalling failing in vb.net 2003 The sample in the help file does not work. I tried now for days ... Pls could anybody post a sample, including necessary imports and so on -
0
2047
by: zman77 | last post by:
EDIT: -- forgot to mention... I am using Visual Studio 2005, on Win XP, on an intel machine Hi. This is my first post, though I've "lurked" for a while because I find these forums very helpful. Ok my problem is the following. I have a class that contains a "MakeByteArray" function. I have many objects of that class. Inside that function, I have a private variable, that is NOT static. It seems that when I put all these objects in...
0
4509
GaryTexmo
by: GaryTexmo | last post by:
Nothing amazing here, this is just a base groundwork for a debug window that someone could use to output debug text in a windows application. It provides fairly basic functionality so feel free to modify to suit your purposes. The topic came up in a question thread (somewhat) and mostly it reminded me that I had been meaning to make one of these so figured I'd share it. It's important to note that there are other methods of gathering debug...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.