background preloader

.NET

Facebook Twitter

Articles

Development Tools and Languages. Code Snippets. A code snippet is a block of reusable code that you can insert where you need it in your code. Snippets can be simple or more complex—for example, blocks such as try-finally and if-else are commonly used, but you could also use snippets to insert entire classes or methods. Visual Studio enables two kinds of code snippet: insertion snippets, which are added at a specified insertion point, and surround-with snippets (C# and C++ only), which are added around a selected block of code. To insert an insertion snippet in your code, put the cursor where you want the snippet to appear, open the shortcut menu, choose Insert Snippet, and then navigate to the snippet you want, select it, and press the Tab key. If you already know the name of the snippet, just type its name at the cursor and then press Tab+Tab. For example, you could insert the following C# insertion snippet by typing tryf and pressing Tab+Tab, or by using the Insert Snippet command. if (true) { return FALSE; }

Grasshopper – The Visual Studio Plugin for .NET Java applications. Mainsoft.com Search What is Grasshopper? Key features MSIL to Java bytecode compilation Java EE compliant applications Visual Studio integration Access to external Java components Open source .NET Framework Powered by Grasshopper <div style="display:none"> <a href=" <a href=" Mainsoft ® for Java EE (aka Grasshopper), a freely available Visual Studio plug-in that you can use to create server and ASP.NET applications, or port existing .NET applications to Linux and other Java-enabled platforms, without having to re-write your code in the Java language. .NET to Java: MSIL to Java bytecode compilation Grasshopper provides a patented cross-compiler that compiles Microsoft Intermediate Language (MSIL) into standard Java bytecode.

Grasshopper produces pure Java deployment packages that can be deployed on any Java EE compliant application server, on any platform, using regular Java EE deployment tools. Cross-platform debugger. Failure trying to start user instance. Pre-defined Keyboard Shortcuts. You can more easily access a variety of commands and windows in Visual Studio by choosing the appropriate keyboard shortcut. This topics lists the default shortcuts for the General Development profile, which you might have chosen when you installed Visual Studio. No matter which profile you chose, you can identify the shortcut for a command by opening the Options dialog box, expanding the Environment node, and then choosing Keyboard. You can also customize your shortcuts by assigning a different shortcut to any given command.

For a list of common keyboard shortcuts and other productivity information, see Tips and Tricks for Visual Studio and Productivity Tips for Visual Studio. The sections in the following table include commands that are global in that you can access them from anywhere in Visual Studio by using keyboard shortcuts: Each section in the following table includes commands for which the keyboard shortcuts are specific to the context for which the section is named. Reference.

Data access

Visual C# C# (pronounced "C sharp") is a programming language that is designed for building a variety of applications that run on the .NET Framework. C# is simple, powerful, type-safe, and object-oriented. The many innovations in C# enable rapid application development while retaining the expressiveness and elegance of C-style languages. Visual C# is an implementation of the C# language by Microsoft. Visual Studio supports Visual C# with a full-featured code editor, compiler, project templates, designers, code wizards, a powerful and easy-to-use debugger, and other tools. The .NET Framework class library provides access to many operating system services and other useful, well-designed classes that speed up the development cycle significantly. Getting Started with Visual C# Introduces the features of C# for programmers who are new to the language or are new to Visual Studio, and provides a roadmap for finding Help about Visual Studio.

Using the Visual C# Development Environment C# Programming Guide. Extension Methods (C# Programming Guide) Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type.

The most common extension methods are the LINQ standard query operators that add query functionality to the existing System.Collections.IEnumerable and System.Collections.Generic.IEnumerable<T> types. To use the standard query operators, first bring them into scope with a using System.Linq directive. Then any type that implements IEnumerable<T> appears to have instance methods such as GroupBy, OrderBy, Average, and so on.

The following example shows how to call the standard query operator OrderBy method on an array of integers. Access Modifiers (C# Reference) Access modifiers are keywords used to specify the declared accessibility of a member or a type. This section introduces the four access modifiers: The following five accessibility levels can be specified using the access modifiers: public: Access is not restricted. protected: Access is limited to the containing class or types derived from the containing class. Internal: Access is limited to the current assembly. private: Access is limited to the containing type. This section also introduces the following: Reference Concepts Other Resources. XML Documentation Comments (C# Programming Guide) In Visual C# you can create documentation for your code by including XML elements in special comment fields (indicated by triple slashes) in the source code directly before the code block to which the comments refer, for example: /// <summary> /// This class performs an important function. /// </summary> public class MyClass{} When you compile with the /doc option, the compiler will search for all XML tags in the source code and create an XML documentation file.

To create the final documentation based on the compiler-generated file, you can create a custom tool or use a tool such as Sandcastle. For more information, see the C# Language Specification. The language specification is the definitive source for C# syntax and usage. Design Guidelines for Developing Class Libraries. This section provides guidelines for designing libraries that extend and interact with the .NET Framework. The goal is to help library designers ensure API consistency and ease of use by providing a unified programming model that is independent of the programming language used for development. We recommend that you follow these design guidelines when developing classes and components that extend the .NET Framework. Inconsistent library design adversely affects developer productivity and discourages adoption. The guidelines are organized as simple recommendations prefixed with the terms Do, Consider, Avoid, and Do not.

These guidelines are intended to help class library designers understand the trade-offs between different solutions. These guidelines are excerpted from the book Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, 2nd Edition, by Krzysztof Cwalina and Brad Abrams.