DotNET Schools

Blogs & Tutorials for Microsoft.NET and Leading web Technologies

How to Get Free Azure Credits ($500) for 1 Year

Most of us are aware of the free Azure credits provided by Microsoft via the website which provides $200 credits. It may differ in your local currencies.

If you are going take benefits of free azure credits of $200 using the website then it’s only for one month. It is good if you are doing business so you can gea  trial for one month and you host multiple things for a month and you can make the decision that of with whom you want to go for cloud service.  Read More >>

All About .NET Framework 4.6.1

.NET Framework 4.6.1 has been release about a month ago and it has a lot of improvements and fixes for previous framework version. I will explain about new features, fixes, enhancements, supported operating system and supported Visual studio versions.

The .NET Framework 4.6.1 builds on the .NET Framework 4.6 and it added a lot of new features and also fixes of 4.6. If you are using visual Studio 2015 then to use Microsoft .NET Framework 4.6.1 you have to just update to Visual Studio 2015 SP1. If you do not want to upgrade your visual studio 2015 to SP1 or you are using Visual Studio 2012 or Visual Studio 2013 then you can Microsoft .NET Framework 4.6.1 Developer Pack.  Read More >>

Windows Form Pass an Argument from Outside and Attach to Debugger

I know that some of the windows form developers may be using this feature already but most of the windows form developer is not aware about it and they use to write Thread.Sleep(time); and rebuild the program and then attach to process.
 

Suppose we have to attach a debugger then:

  • Go to Main method and Write Thread.Sleep(time).
  • Build the solution (also need to copy data to another server if it is running on Remote server).
  • Attach to process .  Read More >>

Index Initializers in C# 6

In C# 6 Indexes can be initialized easily with neat & clean code,

  1. var user = new User    
  2. {    
  3.    [1] = "bnarayan...@gmail.com"  
  4.    [2] = "bnarayan...@outlook.com",    
  5.    [3] = "bnarayan...@yahoo.com"  
  6.    [4] = "bnarayan...@hotmail.com",    
  7.    [5] = "bnarayan...@live.com",    
  8.    UserName = "BNarayan",    
  9.    ContactNumber= "99xxxxxxxx"    
  10. };  


Read More >>

Break Vs Continue in C#

Break and continue is a very basic concept of any programming language and I think it is supported by almost all popular languages e.g. C++, C#, Java, JavaScript, etc. I know that most of us know about it very well but for fresher guys its little bit confusing. So, I am explaining here so that even fresher can understand and use it easily.

Break (breaks the loop/switch)

Break statement is used to terminate the current loop iteration or terminate the switch statement in which it appears  Read More >>

C# 6 Modified & Removed Features

Using static classes as directive

Earlier Releases

  1. using System.Console;   
  2. using System.Convert;    
  • In the previous release we do not need to use the “static” keyword for using static classes as directive.
  • In previous version we can only use static classes and namespaces in as directive.

Current Release (VS 2015)

  1. using static System.Console;   
  2. using static System.Convert;    
  1. Now we need add static keyword to use static classes as directive.
  2. In previous release apart from namespace we can use static classes. But in current release (VS 2015) using static keyword we can include static classes & non static classes, too.

    For code snippet of Static Classes as directive visit here & for Non-Static classes as directive visit here.

Primary Constructors

Earlier Releases

  1. namespace PrimaryConstructorDemo   
  2. {   
  3. class PrimaryConstructorDemo(int employeeId, string empName, string empDesignation)   
  4. {   
  5. public int EmployeeId { get; } = employeeId;   
  6. public string EmployeeName { get; } = empName;   
  7. public string EmployeeDesignation { get;} = empDesignation;   
  8. }   
  9. }   

Current Release (VS 2015) 

  • This feature has been removed.

    constructors

Declaration expressions in C#

  • Removed in Visual Studio 2015 Latest Releases.

Out parameters in VB

  • Removed in Visual Studio 2015 Latest Releases.

Check-out Files in Visual Studio 2015 TFS Modified from Outside

I want to share a real time scenario which I faced in Visual Studio 2013. Suppose we have made some changes in .cs files from outside the application i.e. not modified from Visual Studio 2013.

Let say I modified 50-100 files using Beyond Compare  or replaced some data in files (e.g. assemblyinfo.cs) using TexRep  then If I want to check in those files in TFS then I cannot see it in pending changes.

So the issue is I am not able to view files checked-out in pending changes list which I have modified from outside the source editor. Visual Studio 2013/2015 will not detect it.  Read More >>

Expression - Bodied Methods in C# 6

In C# 6 Microsoft introduces a new feature Expression-bodied Methods which is very similar to and inspired by anonymous lambda expression. But there are some differences between these two.

In case of Expression-bodied methods it must have return type, name and returned expression.

We can use access modifiers (private, public, protected, internal and protected internal) with expression-bodied method. We can declare it as virtual, static or it can also override its parent class method. It can be asynchronous if it is returning void.   Read More >>