473,387 Members | 1,391 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,387 software developers and data experts.

what is watch window really showing

Hi,

If I have the code line "DateTime d1 = DateTime.Now;" and
look at d1 in the watch window, I thought I'd only see the
properties of the DateTime object variable d1.

However I seem to be seeing lots of other properties and
objects - can anyone explain what these are and where they
come from?

i.e. the watch window column headings are Name/Value/Type,
and I see some of the following (6 items given) -

+System.ValueType {System.DateTime} System.DateTime - an
object
+Date (9/9/2004) System.ValueType - an other object
DatePartDay 3 int
....
Day 9 int - this is a DateTime property, so I understand
where it has come from :)
DayOfWeek Thursday System.DayOfWeek
....
+DaysToMonth365 {lenght=13} int[] - yet another object
....

Can anyone shed any light on where these 5 out of the 6
above come from?

I also tried to declare a variable for DatePartDay
via "int i = d1.DatePartDay;" in code but get the compile
error "'System.DateTime.DatePartDay' is inaccessible due
to its protection level"

TIA, Neil.
Nov 16 '05 #1
3 2371
Hi Neil,

The Watch window shows all private, protected and internal members in
addition to the public ones. Obviously, the DateTime type has a number or
private members, so you see them in the Watch window.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Neil" <nc****@tullib.com.auSPAM> wrote in message
news:06****************************@phx.gbl...
Hi,

If I have the code line "DateTime d1 = DateTime.Now;" and
look at d1 in the watch window, I thought I'd only see the
properties of the DateTime object variable d1.

However I seem to be seeing lots of other properties and
objects - can anyone explain what these are and where they
come from?

i.e. the watch window column headings are Name/Value/Type,
and I see some of the following (6 items given) -

+System.ValueType {System.DateTime} System.DateTime - an
object
+Date (9/9/2004) System.ValueType - an other object
DatePartDay 3 int
...
Day 9 int - this is a DateTime property, so I understand
where it has come from :)
DayOfWeek Thursday System.DayOfWeek
...
+DaysToMonth365 {lenght=13} int[] - yet another object
...

Can anyone shed any light on where these 5 out of the 6
above come from?

I also tried to declare a variable for DatePartDay
via "int i = d1.DatePartDay;" in code but get the compile
error "'System.DateTime.DatePartDay' is inaccessible due
to its protection level"

TIA, Neil.


Nov 16 '05 #2
Hi Dmitriy,

Thanks for the reply. Still a bit stumped though!

How do I find these members then? The Class Library for
the System.DateTime structure off MSDN gives me the public
members, but where are the ones you mention? How do they
get "attached" to the DateTime structure?

They can be viewed in the watch window, but never
displayed eg from my original post "int i =
d1.DatePartDay;" but get a compile error - how come?

Thanks, Neil.
-----Original Message-----
Hi Neil,

The Watch window shows all private, protected and internal members inaddition to the public ones. Obviously, the DateTime type has a number orprivate members, so you see them in the Watch window.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Neil" <nc****@tullib.com.auSPAM> wrote in message
news:06****************************@phx.gbl...
Hi,

If I have the code line "DateTime d1 = DateTime.Now;" and look at d1 in the watch window, I thought I'd only see the properties of the DateTime object variable d1.

However I seem to be seeing lots of other properties and
objects - can anyone explain what these are and where they come from?

i.e. the watch window column headings are Name/Value/Type, and I see some of the following (6 items given) -

+System.ValueType {System.DateTime} System.DateTime - an
object
+Date (9/9/2004) System.ValueType - an other object
DatePartDay 3 int
...
Day 9 int - this is a DateTime property, so I understand
where it has come from :)
DayOfWeek Thursday System.DayOfWeek
...
+DaysToMonth365 {lenght=13} int[] - yet another object
...

Can anyone shed any light on where these 5 out of the 6
above come from?

I also tried to declare a variable for DatePartDay
via "int i = d1.DatePartDay;" in code but get the compile error "'System.DateTime.DatePartDay' is inaccessible due
to its protection level"

TIA, Neil.


.

Nov 16 '05 #3
Hi Neil,

These are private or protected members. They are not documented, nor they
are shown by Intellisense - since you should know nothing about their
existence and purpose. In other words, these are members used internally by
the class, but which are not intended to be used outside the class. It's
what is called 'encapsulation' in the OOP world.

Such members are shown in the Watch window solely for debugging purposes so
you could examine the internal state of a class without having to add
individual class members.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Nov 16 '05 #4

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

Similar topics

1
by: pantichd | last post by:
Hello, When I debug a VB.net program and stop at a breakpoint I'd like to be able to see what the collection actually contains. In the watch I keep expanding the "SyncRoot" which just keeps...
1
by: KR.KIM | last post by:
Hi! When I compile my code and try to debugging, i met one trouble in watch window. i can't see some buffer values, it looks filled by 0x00(null) in watch window. but,buffer was filled by real...
0
by: John Gabriel | last post by:
Am using VC++ 2005 Express Beta Edition with XP Home. When I step through this code with the debugger, I cannot see the values of tmp or j in the Watch window. All I see is : error:identifier 'j'...
16
by: Ricky W. Hunt | last post by:
Is there a way to watch a variables value in real-time without running in break mode? It seems you should just be able to give VB a list of variables/objects that you could see at any time without...
0
by: eBob.com | last post by:
I have an array Dim FileInfo(MaxFiles) As OFI of Structure Structure OFI 'OneFileInfo Dim Displayed As Boolean ... Dim Dirname As String
4
by: Austin | last post by:
I converted a project from VC6 to VC7. There is a problem in one class of this dll. ///Class1.h class CClass1: base class { private: int m_nTest; public : void Function1() }
6
by: Tau | last post by:
look my simple code below(vc8): double ends; ends=8.3; when i debug it, the variable ends cannot be displayed in the watch window. it just said "error: index '0' out of bound for...
2
by: =?Utf-8?B?UnVkeQ==?= | last post by:
Hello all! So a few days ago in VS 2003, working on a windows app in vb.net. I have a tab in my main window. The same place where your form window is, vb window, start page, etc. What is this...
8
by: Greg | last post by:
Dear all, I've trouble with debugging a huge programm. I want to look into the properties of an object when I am at a breakpoint. But in the watch window he tell's me that the object is "out of...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.