Example Application Screenshot

Get Table Schema Information Using Ado.Net

The item marked as 1 is a multi-line text-box control used to show the table schema shown in section 1 of this example. The Get Table Schema button (Marked as 2) displays the schema data of the discount table in the multi-line text box. Before using this example, one need to setup the connection string to the Pubs database. Setting the connection string for the NorthWnd database is shown in the below video. We can follow the same method to set the connection string for the Pubs database as the table DISCOUNTS resides in it. When you create Connection String name it as PUBSDB.

Read More…
Custom Debug Visualizer - For C# Stack

Creating Custom Debug Visualizer in C#

Debug Visualizers are visual studio IDE’s debugging component. These components represent the variables and class objects in meaningful form so that it can be easily visualised. Say; for example, you have class ABC to store the “Passport Size” photo of a person and using the visualizer you can see the photo of the person while debugging the object of ABC. In this example, we will create our own visualizer to see the Stack data structure. You can use the technique explained here with any objects.

The Item marked as 1 show five elements pushed into the Stack object of the Dot Net Framework. Item marked as two shows the Visual studio debugger showing the Visualizer written by us. If we write multiple visualizers for the same Stack object, C# debugger lists them all here. Moreover, we can mention the default one by placing the check mark. Clicking the lens icon invokes that default visualizer. The item marked as three shows the simple stack debug visualizer which lists all the current items in the stack. Left is the Top of the Stack and right is the bottom of the stack.

Read More…
Debugging Attributes C# Example

C# Debugger Attributes Explained

In the last example, we saw about Logging and getting function call stack data. In this article, we will see about Debugger Attributes which controls debugging behavior of the objects and gives a rich experience to the debugging user. An Attribute is a Tag set over the elements like Class, Functions, assemblies, etc. These tags work out how the elements should act at run time. Let us see below specified debugging attributes with a simple example:

DebuggerBrowsable Attribute
DebuggerDisplay Attribute
DebuggerHidden Attribute

Read More…
Debugging Technique Part1 - Example

Debugging Using C# System.Diagnostics

The text box marked as 1, shows the status of the debugger. When we attach the application with the debugger, the status shows Attached. Clicking the Refresh button (Marked as 2) updates the debugger status. Clicking the Break on Code button (Marked as 3) dynamically breaks the application as breakpoint is hit. This is useful when you want to break the application without the manual insertion of breakpoints. When we click the Debug Log (marked as 4) button, the example produces the log entries in the debug output window. In the same debug output window, we print the application call stack whenever user clicks the Output Stack Trace button (Marked as 5).

Read More…
MasterPage Example

ASP.Net Master Page Example

Master Pages help in providing the consistently laid-out pages. When we switch between other pages, we can note the steady look and feel throughout the websites. Microsoft provides Master Page support from ASP.Net 2.0 onward. The Master Page is used to making the outer skeleton structure of the websites and we can see this outer skeleton as web page header, footer and sidebars with navigational elements. In this example, we will explore how to create a Master page along with other web pages.

Read More…