Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article
Note
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
To design new types for Visual C# .NET and Visual Basic .NET projects, create them on a class diagram. To see existing types, see How to: View Existing Types (Class Designer).
In the Toolbox, under Class Designer, drag one of these onto a class diagram:
Class or Abstract Class
Enum
Interface
Structure (VB) or Struct (C#)
Delegate
Module (VB only)
Name the type. Then select its access level.
Select the file where you want to add the initial code for the type:
To create a new file and add it to the current project, select Create new file and name the file.
To add code to an existing file, select Add to existing file.
If your solution has a project that shares code across multiple apps, you can add a new type to a class diagram in the app project, but only if the corresponding class file is in the same app project or is in the shared project.
Now add other items to define the type:
For Add Classes, abstract classes, structures or structs Methods, properties, fields, events, constructors (method), destructors (method), and constants that define the type Enums Field values that make up the enumeration Interfaces Methods, properties, and events that make up the interface Delegate Parameters that define the delegate Module Methods, properties, fields, events, constructors (method), and constants that define the module See Creating Members.
Click the type's shape on a class diagram.
In the Properties window, next to the Custom Attributes property for the type, click the ellipsis (…) button.
Add one or more custom attributes with one per line. Don't enclose them in brackets.
When you're done, the custom attributes are applied to the type.
Click the member's name in its type's shape on a class diagram, or its row in the Class Details window.
In the Properties window, find the member's Custom Attributes property.
Add one or more custom attributes with one per line. Don't enclose them in brackets.
When you're done, the custom attributes are applied to the type.
How to: Create Inheritance Between Types (Class Designer) How to: Create Associations Between Types (Class Designer) Creating and Configuring Type Members (Class Designer) Working with Class Diagrams (Class Designer) Designing Classes and Types (Class Designer)