#758 – Cleaning Up using Directives in a File
You use using directives at the top of a file to bring various namespaces into scope, so that you don’t need to fully qualify named members within those namespaces. using System; using...
View Article#759 – Creating a New Type from a Class Diagram
You can create new types by directly entering code in the editor window. You can also add a new type from a class diagram. To start with, either open an existing class diagram or create a new one. To...
View Article#760 – Adding New Class Members from a Class Diagram
In addition to adding new types from a class diagram within Visual Studio, you can also add members to existing types. In the class diagram, you right-click the top area of the class and then click Add...
View Article#761 – Create or Modify Type Members Using the Class Details Window
You can use the Class Details window to easily create or modify a type’s members. To open the Class Details window, start by opening a class diagram. If the Class Details window does not appear, right...
View Article#762 – Creating a Class Diagram Containing Types in the .NET Framework
You typically create a class diagram in a project for the custom types that you’ve created in that project. You can also include types on a class diagram that come from assemblies that your project...
View Article#763 – Fixing a Class Diagram that Cannot Find Types
If you create a class diagram that contains types found in assemblies that your project references, and then you leave the class diagram open when you close Visual Studio, you may see some errors in...
View Article#764 – Expanding All Classes in a Class Diagram
By default, when you add types to a class diagram, they are displayed collapsed, showing only the name of the type and the category (e.g. class, interface). You can expand individual types by clicking...
View Article#765 – Adding Base or Derived Classes to a Class Diagram
You can use the class diagram to follow the inheritance chain for any class currently in the diagram, moving up to the class’ base class or down to the classes that derive from the class. For example,...
View Article#766 – Adding an Interface to a Class Diagram
If you add a class to a class diagram and the class implements one or more interfaces, you’ll see the interfaces show up on the class with the standard interface designator (a short line with a circle...
View Article#770 – Use Intellisense to Get List of Methods to Override
In a derived class, you can override a member of the base class if it’s declared as virtual. In Visual Studio, the Intellisense feature can help you to discover the methods that can be overridden....
View Article#848 – Viewing the Call Stack in Visual Studio
The call stack keeps track of the currently executing method in your application, and from where that method was called. You can use the debugger in Visual Studio to view the current call stack when...
View Article#849 – Using the Call Stack in Visual Studio to Navigate within Your Code
When in break mode within Visual Studio, you can view the call stack in the Call Stack window. When you bring up the Call Stack window, there will be a yellow arrow pointing to the top of the call...
View Article#875 – Looking at the Call Stack after Catching an Exception
After an exception is thrown, it bubbles up the call stack until a handler that can handle the exception is found. If you set a breakpoint in an exception handler, you can then use the debugger in...
View Article#912 – Intellisense Can Show Exceptions that a Method Might Throw
In some cases, when the Intellisense function within Visual Studio shows you information about a method that you are going to call, it will also list potential exceptions that the method might throw....
View Article#914 – Using the Debugger to Break when an Exception Is Thrown
By default, if you have an exception handler defined, the debugger in Visual Studio will not break (i.e. stop) at the point where an exception is thrown. You can, however, configure Visual Studio to...
View Article#957 – Naming Files that Contain C# Code
Files that contain C# code are typically named using a .cs extension. You can, however, include C# in a code having any extension you like. Note that in Visual Studio, if the extension is other than...
View Article#966 – Visual Studio Code Editor Helps with Indenting
You’ll typically use a consistent indent level in your source code to assist with readability. Visual Studio helps by automatically indenting your code as you enter it. For example, if you enter an if...
View Article#1,090 – Using Visual Studio to Verify How Floating Point Numbers Are Stored
Recall that floating point numbers are stored in memory by storing the sign bit, exponent and mantissa. We showed that the decimal value of 7.25, stored as a 32-bit floating point value, is stored as...
View Article#1,184 – Managing using Directives, part I
As you write code, Visual Studio will let you know that you’ve used an identifier that it doesn’t know by marking it with a red squiggly underline. Below, we’ve started creating a class that derives...
View Article#1,185 – Managing using Directives, part II
You can add missing using directives by using the Resolve command. You can also clean up the current list of using directives in a file, removing the ones that are no longer needed. You can remove...
View Article