C# 7.0 All-In-One For Dummies Cheat Sheet - dummies
Cheat Sheet

C# 7.0 All-In-One For Dummies Cheat Sheet

From C# 7.0 All-in-One For Dummies

By John Paul Mueller, Bill Sempf, Chuck Sphar

C# provides you with access to a phenomenal array of programming options. Use this cheat sheet to help you get the job done faster and easier when using C# as your development solution of choice.

A Quick Overview of C# 7.0 Web Application Templates

Most developers starting a project today will want to provide web application support, even if the initial application is a desktop application. Users no longer want to be tied to the desktop; they want to spread their wings and use devices of every sort anywhere they want to access their data. The following table provides a list of the kinds of web applications you can build using C# 7.

Project Type Supported Environments Description
ASP.NET Dynamic Data Entries Web Site New Web Site Creates a data-specific website that relies on dynamic data access techniques using either Entity Framework (EF) or LINQ-to-SQL programming. The structure consists of a presentation layer, a data layer, data source mapping, and the data store.
ASP.NET Empty Web Site New Web Site, ASP.NET Web Application (.NET Framework), ASP.NET Core Web Application (.NET Core), ASP.NET Core Web Application (.NET Framework) Creates an empty website that doesn’t include any files, but does include basic support.
ASP.NET Web Forms Site New Web Site, ASP.NET Web Application (.NET Framework) Creates a basic website that includes standard forms that are ready to fill out and use.
ASP.NET Web Site (Razor v3) New Web Site Creates a basic website that includes standard forms. The form language relies on the Razor language (CSHTML) which is based on C#. Essentially, this kind of project is designed to make you more efficient, but only if you’re willing to learn the Razor language.
Azure API App ASP.NET Web Application (.NET Framework) Constructs a cloud-based application environment that allows public access of services using a Web API. You can publish your APIs so that others can access the code to create a variety of application types.
MVC (Model-View-Controller) ASP.NET Web Application (.NET Framework) Creates a basic website based on the Model-View-Controller approach, in which the model encapsulates data, the view displays the data to the user, and the controller encapsulates business logic used to access the data. The goal is to create applications quickly and in a manner that is easy to update and works well with teams.
Single Page Application ASP.NET Web Application (.NET Framework) Constructs an application environment that is meant to interact with a Web API using a combination of HTML5, CSS3, and JavaScript. The single page represents a starting point that you can use to develop a much larger application.
WCF Service New Web Site Defines a method for accessing services using the Windows Communication Foundation (WCF) framework rather than a more standard Web API. An oversimplification of the differences from the end user (developer access) perspective is that WCF relies on SOAP-based services, while a Web API generally relies on RESTful services.
Web API ASP.NET Web Application (.NET Framework), ASP.NET Core Web Application (.NET Core), ASP.NET Core Web Application (.NET Framework) Defines a method for accessing services using a Web API rather than WCF. This project type represents the direction that modern applications are taking to simplify code access using RESTful techniques.
Web Application ASP.NET Core Web Application (.NET Core), ASP.NET Core Web Application (.NET Framework) Creates a basic website that relies on the ASP.NET Core approach rather than the full functionality of the .NET Framework. This application can use the MVC methodology to development and includes support for Web API projects (using the RESTful programming technique).

Common Visual Studio 2017 Keyboard Shortcuts

Touch typists find that using keyboard shortcuts makes them even faster than normal. Of course, you need to know the keyboard shortcuts before you can use them. The following table contains the keyboard shortcuts used most often in Visual Studio 2017. You can find a complete list of keyboard shortcuts online.

Shortcut Purpose
Alt-Enter Show the properties panel for a selected object
Alt-Shift-A Add an existing item to the project
Ctrl-Alt-L Show Solution Explorer
Ctrl-Alt-P Attach the debugger to a process
Ctrl-B + Ctrl-T Toggle code bookmark
Ctrl-F Display the Find dialog
Ctrl-F5 Start a project without debugging
Ctrl-H Display the Replace dialog
Ctrl-K+Ctrl-C Comment a selected block of code
Ctrl-K+Ctrl-U Un-comment a selected block of code
Ctrl-M +Ctrl+M Expand or collapse a selected code fragment (toggle)
Ctrl-M +Ctrl-O Collapse all code to definitions
Ctrl-M +Ctrl-P Expand all definitions to code
Ctrl-N Add a new file
Ctrl-S Save file
Ctrl-Shift-A Add a new item to the project
Ctrl-Shift-B Build solution
Ctrl-Shift-Tab Scroll backwards through open windows
Ctrl-Tab Scroll forward through open windows
Ctrl-Y Redo typing
Ctrl-Z Undo typing
F5 Start a project in debug mode
F6 Build solution
F7 Show the code window
Shift-Alt-C Add a new class to the project
Shift-F6 Build project
Shift-F7 Show the designer window

C# 7.0 Keyword Listing

All programming languages rely on keywords, which are words that are reserved and that you can’t use for your personal needs. Knowing the keywords enables you to choose other words for your code. For example, you can’t create a variable named while because it’s a C# keyword. The following table contains the C# keywords.

abstract as base bool break
byte case catch char checked
class const continue decimal default
delegate do double else enum
event explicit extern false finally
fixed float for foreach goto
if implicit in int interface
internal is lock long namespace
new null object operator out
override params private protected public
readonly ref return sbyte sealed
short sizeof stackalloc static string
struct switch this throw true
try typeof uint ulong unchecked
unsafe ushort using using static virtual
void volatile while