Angle Brackets?

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

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.
 
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?
 
I was wondering, can anyone tell me what statements in angle brackets
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.
 
Back
Top