Visual Studio

  • Generate C# Classes from a JSON String Easily Using Visual Studio

    As developers, we are often faced with certain tasks that are very repetitive in nature, which can also be time consuming to solve it. For example, whenever we need to reserialize a complex JSON string to classes we may need to write a lot of code. Until recently, whenever I needed to do such task I invariably create the classes manually and if it's a complex string, I was spending way too much time on that.

    When the instances like these began to happen every now and then, I decided to search for online options which can spit out classes from a JSON string. After some googling, I found out this site json2csharp.com which can do what I was looking for. You only need to paste the JSON in the input box and click on the Generate button to get the classes in C#.


  • Visual Studio 2017 - Introducing the New Installation Experience

    As many of you have already are aware that Microsoft has released a Release Candidate version of the latest incarnation of Visual Studio during the Connect() event held at New York City in November. Visual Studio is one of the most widely used IDE in the world and the latest avatar comes with lot of new features and performance improvements under the hood. The most notable among these is the all new installation experience which considerably reduces the installation time as well as eradicates a lot of pain points that an user faced during the installation of the earlier versions of the software.

    Preparing Installation

    Visual Studio 2017 RC is free for all and can be downloaded from the Visual Studio site here and also read about the minimum system requirements is available at https://www.visualstudio.com/en-us/productinfo/vs2017-system-requirements-vs before you start the installation. You will get a nice little installer utility from the download link and when you run vs_enterprise.exe, it will show the new launch screen which will tell you to accept the license before proceeding to the installation.

    Selecting Components

    Visual Studio is used by a wide variety of users for developing different types of application and majority of them doesn't need to install every garbage that comes along with the installation package. So deciding what to choose for your need was confusing and particularly about the dependencies that need to selected for a hassle free experience.

    In Visual Studio 2017, the concept of Workloads are introduced to solve this problem and now there are separate workloads for .NET desktop development, web development, UWP development etc. So if you are a web developer and selecting the Web Development workload will ensure that Visual Studio will install all the necessary tooling and dependencies that are needed for developing web applications. 


  • Visual Studio Tips & Tricks - Window Layouts

    Another neat little feature available in Visual Studio is the option to customize the window layouts. This comes in handy when you work on different machines and you want the same look and feel for the enviroment across all your devices and instances. 

    For this to work, first you need to log in with the Microsoft account while using Visual Studio, so that whatever changes you make for customizing the layout will get stored in the cloud and will be used to synchronize the layout across devices.

    Let's see how we can manage layouts using Visual Studio. I prefer to have least tabs open in the IDE and likes have the code editor uses most of the layout. So I have closed all the open tabs in the right side as well as in the bottom.

    Saving Layout

    Now we can save out layout from Window -> Save Window Layout.


  • Visual Studio Tips & Tricks - Quick Actions

    In the previous versions of Visual Studio we have refactoring options such Encapsulate Field, Extract Method etc in the context menu and the Resolve option for adding namespaces when you refer a method which are not imported etc. In VS 2015, these all are clubbed together and will appear in once place called Quick Actions. They also added new features like previewing and integreated search into it making it more productive. Also in statements wherever the quick actions are available, a Light Bulb will be shown in the left side very much like the feature in tools like Reshaper.

    To see this in action, let's call a new method which is not defined in the code. The light bulb will immediately appear along with the red squiggly once you complete the statement as shown below.

    You can click on the bulb to bring up the suggested action, which is to generate the method stub for PerformAction. If we click on the arrow button, you will get a preview of the content of the method that is going to be generated. This feature is newly added in Visual Studio 2015, earlier we had only the option to generated the method


  • Visual Studio Tips & Tricks - Performance Analysis

    In this post, I am going to introduce a new feature made it's debut in Visual Studio 2015, the diagnostic tools, which I will definitley help you to easily identify performance bottlenecks and issuees while developing apps using the most widely used IDE.

    One new feature you are going to easily notify is that whenever you debug code in Visual Studio 2015, it will show the time eapsed right next to it as shown in the image below. 

    Time Values while debbugging

    You can configure the type of information that needs to be shown from the options. You have the option to set either CPU clock ticks or Miliseconds. By default it's miliseconds. 

     

    Opening Diagnostic tools

    If you hover your mouse over the time value, it will show you a popup like the one below.


  • Visual Studio Tips & Tricks - Error List Window

    In this post, I am going to give you some tips for the Error List window is Visual Studio , which I hope will help you to increase the productivity while using the most widely used IDE.

    The error list will show the application error and warnings with code starting with "CSXXXX" where as the errors from code analysis will start with "CAXXX". Also you have the option to filter out error, warning, messages by clicking on the button in the top bar in the window. Those three buttons will act as toggle buttons and based on its state it will filter the list.

    Errors, Warnings and Messages

    Filtering Errors by Document