Check If IEnumerable<> or List<> Type is Empty / Null

There are three ways to check whether IEnumerable<> or List<> type is empty / null or not. == NULL .Any() .Count() In any case, you always want to combine “== null” and, either “.Any()” or “.Count()”, with OR (“||”) operator. In addition, you want to put “== null” before the other condition. The reason for this is, “if” condition goes from left to right. So, if the list object is null, it will not go to the second check,…

Read More

Visual C# Code Snippets

By default the following code snippets are included in Visual Studio. Name (or shortcut) Description Valid locations to insert snippet #if Creates a #if directive and a #endif directive. Anywhere. #region Creates a #region directive and a #endregion directive. Anywhere. ~ Creates a destructor for the containing class. Inside a class. attribute Creates a declaration for a class that derives from Attribute. Inside a namespace (including the global namespace), a class, or a struct. checked Creates a checked block. Inside a method, an indexer, a property accessor, or an event…

Read More

Visual Studio 2015 keyboard shortcuts – The complete list

Analyze Navigate Backward Shift+Alt+3 Navigate Forward Shift+Alt+4 Architecture New Code Map Ctrl+\, Ctrl+O New UMLor Layer Diagram Ctrl+\, Ctrl+N Architecture Context Menus Add Node Ins Both Dependencies B Incoming Dependencies I Outgoing Dependencies O New Comment Ctrl+Shift+K Ctrl+E, C Remove Del Rename F2 Build Build Solution Ctrl+Shift+B Cancel Ctrl+Break Compile Ctrl+F7 Run Code Analysison Solution Alt+F11 Class Diagram Collapse Num – Expand Num + Class View Context Menus Properties Alt+Enter Misc Commit All Edits Shift+Alt+U Move Left Edgetotheleft Ctrl+Shift+,…

Read More