By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,865 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,865 IT Pros & Developers. It's quick & easy.

Angle Brackets?

P: n/a
Hi,

I was wondering, can anyone tell me what statements in angle brackets are
for in VB? For example, the default
<System.Diagnostics.DebuggerStepThrough()thing that the IDE puts before
the InitializeComponent method of a form.

Apr 3 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,
>
I was wondering, can anyone tell me what statements in angle brackets
are for in VB? For example, the default
<System.Diagnostics.DebuggerStepThrough()thing that the IDE puts
before the InitializeComponent method of a form.
The code in angle brackets in Vb.net is 1 or more 'attributes'.
These attributes confer additional information regarding the code that they
prefix.

Sometimes they are examined by the Compiler but they can also be examined
by the debbugger, The visual studio designers or your own .Net code.
They can therefore affect the behavior of any these systems.

The example you gave "<System.Diagnostics.DebuggerStepThrough()>" instructs
the debugger to pass directly over this method rather than step into it.

So for instance if you create a standard windows forms app with a single
form and then hit F11 to start it off, you will find yourself with a WinForms
app when you might have expected to have found yourself stepping through
code. If you comment out the attribute in form1.Designer.vb (or in Form1.vb
in VS2003) then you should find that starting your prog with F11 should start
debugging on the InitialiseComponent Method.

(Note the previous test and results were performed in VS2005 with the "General"
Keystroke settings)
Does this answer your question?

--
Rory
Apr 3 '07 #2

P: n/a
>I was wondering, can anyone tell me what statements in angle brackets
>are for in VB? For example, the default
<System.Diagnostics.DebuggerStepThrough()thing that the IDE puts
before the InitializeComponent method of a form.

The code in angle brackets in Vb.net is 1 or more 'attributes'.
These attributes confer additional information regarding the code that
they prefix.

Sometimes they are examined by the Compiler but they can also be examined
by the debbugger, The visual studio designers or your own .Net code.
They can therefore affect the behavior of any these systems.

The example you gave "<System.Diagnostics.DebuggerStepThrough()>"
instructs the debugger to pass directly over this method rather than step
into it.
So for instance if you create a standard windows forms app with a single
form and then hit F11 to start it off, you will find yourself with a
WinForms app when you might have expected to have found yourself stepping
through code. If you comment out the attribute in form1.Designer.vb (or in
Form1.vb in VS2003) then you should find that starting your prog with F11
should start debugging on the InitialiseComponent Method.

(Note the previous test and results were performed in VS2005 with the
"General" Keystroke settings)
Does this answer your question?
I think so. I wasn't clear on what (if anything) was interpreting those, but
they looked more like compiler directives than mere code.

Apr 3 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.