Category: C#

How to Call Other Constructors within the Same Class in C# ?

There are times when you want to avoid duplicating code and want to reuse them when working on multiple constructors . If you want to call other constructors from a constructor within the same class , you need to use the this keyword . How to Call Other Constructors within the Same Class in C# ? Below is a sample code snippet that demonstrates how…

Verbatim String Literals in C#

C# supports Verbatim String literals which begin with @ followed by the string data and doesn’t have a escape sequences within the string. This might be specially useful when you want to represent the file path . Below is a representation of Verbatim String Literals in C#

What are the Different Tile templates in Windows Phone 8?

The Windows Phone 8 SDK provides the developers with the option to use one of the below tile templates in their windows phone 8 app. 1. TemplateFlip 2. TemplateCycle 3. TemplateIconic What are the Different Tile templates in Windows Phone 8? The TemplateFlip provides the developers to display information in the front and the back side of the tile where the tile flips front and…

How to provide a default value for Auto Implemented Property in C#?

Sometimes, one might want to provide a default value for the auto implemented properties. For example, you might want to provide a default text for a string value instead of null. This can be achieved by providing the default value in the constructor for the properties. Below is a sample code snippet demonstrating how to do it. How to provide a default value for Auto Implemented…

How to Split a String on newlines in C#?

Ever wanted to split an input string in to new lines in .NET (c#) that has a new line character? Below is a sample code snippet that demonstrates how to do it. How to Split a String on newlines in C#?

Example of Predicate Delegate in C#

Predicate Delegate is an interesting feature in .NET Framework which is like a reference to a function which returns either true or false. Example of Predicate Delegate in C# Below is a sample code snippet demonstrating the usage of Predicate Delegate in C#

How to Detect the Current device in Universal App ?

To detect the current device platform in the Windows Universal App , the developers can use the predefined ifdirectives WINDOWS_PHONE_APP and WINDOWS_APP . How to Detect the Current device in Universal App ? Eg : #if WINDOWS_PHONE_APP // wp8.1 #elseif WINDOWS_APP // windows 8.1 #endif

How to Download Map in Windows Phone 8 Programatically using C#?

The Windows Phone 8 SDK provides the MapDownloadTask which lets the users to download the region map which can be used for offline usage. This will launch the Map Download App which lets the users to select the map which needs to be downloaded. How to Download Map in Windows Phone 8 Programatically using C#? Below is a sample code snippet demonstrating how the user…