473,388 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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 2535

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.Diagnostics.Debug.Write(_Age.ToString());
}
get {
return _Age;
}
}
}

Check out the line System.Diagnostics.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.googlegr oups.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.Diagnostics.Debug.Write(_Age.ToString());
}
get {
return _Age;
}
}
}

Check out the line System.Diagnostics.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
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
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...
4
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
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
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...
5
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
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...
0
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....
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.