TechBubbles Microsoft Technology BLOG

TagC#

Async / Await guide-lines

There are lot of different ways to use Async\await in C#. It is bit difficult to understand what different methods, fields and keywords are under tasks and how they are different? This post outlines some bad examples that developer shouldn’t use and explains the alternate solution. Bad example1: This locks up the UI. Never use .Result Above line is wrapper method on taskservice which...

C# 7 features overview

C# 7 added some new features with a focus on code simplification and performance. This post explains C# 7 new features Binary Literals         We now have binary literals like 0b followed by 0’s and 1’s; literals can often get longer so you can add underscore to separate them as shown in above screenshot. Tuples Install-Package “System.ValueTuple” One...

C# 6.0 Features overview

This post outlines the new features that are added to the C# new version 6.0. Enhancement to Auto Properties:  currently auto properties are needed to have setters. This puts disadvantage to immutable data types. Now C# 6 allows only getters on auto properties.C# 6 also   allows initializers to auto properties as shown in the following picture     Using Static classes – Now you...

Immutable Collections in .NET Framework

What are Immutable Collections? Immutable Collections are collections which guarantees that they never change their content and completely thread safe. Immutable suggests that data will not change and will not ever change and moreover you can hold a reference to it as long as you want. Why should we use Immutable Collections when there are Readonly Collections like ReadOnlyCollection<T>, an...

Asynchronous Lambda Expressions in C#5

Asynchronous functions make asynchronous programming similar to synchronous programming. You can read my previous post on C# 5.0 features. Normal methods can written as asynchronous as shown below 1: async Task Demo() 2: { 3: await Task.Delay(10000); 4: Console.WriteLine("Hello World!!"); 5: } You can call the method as await Demo(); Lambda Expressions and anonymous methods can be preceded by the...

What is new in C# and Visual Basic in Visual Studio 2012

  This post discusses the new language features that is introduced in Visual Studio 2012. One of the main things that language team introduced is the idea of producing windows 8 App. These APPs are talking to new API called windows runtime. Small new feature Caller Info Attributes is also added in this release. More about this feature can be read here. This release also brings iterators to...

Caller Info Attributes in C# 5.0

Caller Info Attributes is a new feature in C# 5.0, Caller Info Attributes instructs the compiler to obtain and feed information into the parameter’s default value. You can tag optional parameters using Caller Info Attributes. Three Caller Info Attributes are [CallerMemberName]  – It applies the caller’s member name [CallerFilePath] -  It applies the path to the caller’s source code...

Comparing Two Generic Lists in C#

Today I come across the problem while comparing two different lists. The basic requirement is finding the records which are present in one list but not in other and vise versa. I thought of sharing this piece of code which might  help for you to do the same task. Let us take the two Generic lists named timeEntryList and caseDataList. The aim is comparing these two lists and bring the results...

Visual Studio 2010 IDE Tip–Highlight References

  Highlight References is a new feature in Visual Studio 2010 IDE which allows you visually to navigate between the references to a symbols in a opened file. This feature only available in Visual Studio 2010. Highlight the symbol that you want to navigate in the opened file as shown below   Now press Ctrl + Shift + Down  then your cursor shifts to all instances of the symbol in...

Documenting C# code with XML Comments

This article explains an easy and effective way of documenting your C# code. XML comments are the solution for generating a clean documentation for your code. Visual Studio environment allows you to generate a documentation file for your project. It helps your teammates and other people who using your code. This post will explain how to use XML comments in code and how to generate XML help...

TechBubbles Microsoft Technology BLOG

Follow me

Archives

Tag Cloud