Tag: C#
How to Update Map in Windows Phone 8 Programatically using C#?
The Windows Phone 8 SDK provides the MapUpdaterTask which lets the users to update the region map downloaded earlier which can be used for offline usage. This will launch the Map Settings App which lets the users about the updates to the map (if available). How to Update Map in Windows Phone 8 Programatically using C#? Below is a sample code snippet demonstrating how the…
How to Resize an Bitmap Image in C# ?
Below is a sample code snippet that demonstrates how to resize an Bitmap Image in C#. How to Resize an Bitmap Image in C# ?
How to Get the Battery Level from a Windows Phone 8 device using C#?
The Windows Phone 8 SDK provides the Windows.Phone.Devices.Power.Battery class which can be used to retrieve the battery information of the windows phone. Use the Windows.Phone.Devices.Power.Battery.GetDefault ().RemainingChargePercent property to retrieve the Battery Level from a Windows Phone 8 device programatically using C#. How to Get the Battery Level from a Windows Phone 8 device using C#? Below is a sample code snippet demonstrating the steps used…
How to find if the character entered is Digit in C# ?
The Char class provides a method Char.IsDigit that lets you find if the character entered in the specid string is a digit or not. How to find if the character entered is Digit in C# ? Below is a sample code demonstrating the Char.IsDigit to find if the character entered is Digit in C#.
Example of Lambda Expression with Action Method in C#
Below is a sample code snippet that demonstrates the lambda expression with action method in C#. Example of Lambda Expression with Action Method in C#
Use of var keyword in C#
The var keyword in C# was introduced from C# 3.0 and it beings in the feature of local type inference or implicit type variable in C#. LINQ is one of the case where var keyword can be widely used in C#. Eg: In the above example, the initialization of the name was done using “string” and hence name will be implicitly treated as string. Note…
How to Create an Interface in C# ?
You might need to few functionalities without defining any implementation of the abstract methods. This should later be applied to various types within your project. In this case , one can create an interface which specifies some behavior rather than what the type or member is all about. How to Create an Interface in C# ? Below is a sample interface called IMusic The interface…
How to Read from a Text File in C# ?
Below is a sample code snippet that demonstrates how to read from a text file in C# . How to Read from a Text File in C# ?
Convert.ChangeType Method in C#
The .NET Framework has the Convert.ChangeType Method which converts the object specified to the conversion type. The value should implement the IConvertible interface for the conversion to be successful. Convert.ChangeType Method in C# Below is a simple code snippet demonstrating Convert.ChangeType Method in C#
How to Throw an Exception in C# ?
To indicate and error which can be handled by the caller function , you can use the throw keyword to throw an exception . For example , below is a sample code snippet demonstrating how to throw an exception in C#. How to Throw an Exception in C# ?
How to use SQL like Operator in LINQ and C#?
In a SQL Query, one might use the Like Query which can be used along with the % operator to search of contains within the data. How to use SQL like Operator in LINQ and C#? This article will show it with a sample code snippet. How to use SQL like Operator in LINQ and C#? Below is a sample source code demonstrating the usage…
How to check if the number is positive or negative in C# ?
You can use the > and < operator to check if the number is a positive or negative number in C#. How to check if the number is positive or negative in C# ? If the number is less than zero , it can be considered as negative number. If the number is greater than zero , it is a positive number. Below is a…
Example of Lambda Expression with Action method with String as Parameter in C#
Below is a sample code snippet that demonstrates the lambda expression with action method with string as parameter in C#. Example of Lambda Expression with Action method with String as Parameter
How to detect if a key exists in a Dictionary in C# ?
If you want to detect if a key exists in a dictionary in C# , you can use the contains method of the dictionary which return true if the key is found. How to detect if a key exists in a Dictionary in C# ? Below is a sample source code that illustrates how to find out if the exists in a dictionary using the…
How to Create a Guid Value in C# ?
If you want to create a new Guid value in C# which is random , you can use the Guid class to achieve it. Below is a sample code snippet demonstrating how to do it. How to Create a Guid Value in C# ?
How to find the absolute value of a number in C# ?
Below is a sample code snippet that demonstrates how to find the absolute value of a number in C# . How to find the absolute value of a number in C# ?
How to get last four characters from a string in C#?
This post will provide a simple tip showing how you can get the last 4 characters from a string in C#. How to get last four characters from a string in C#? Assume that you have a string that contains the value “CodersEditor.com” and you wish to get .com from the string and display it. Below is a sample code snippet demonstrating how you can…
How to find if the Character is a Symbol in C# using Char.IsSymbol ?
You can find if the Character is a Symbol in C# using the method Char.IsSymbol. How to find if the Character is a Symbol in C# using Char.IsSymbol ? The Char.IsSymbol method will return true if the specified character is a Symbol else returns false.
Returning Dictionary from LINQ Query in C#
Below is a sample source code demonstrating how to return Dictionary of<int, string> from the LINQ Query result. Returning Dictionary from LINQ Query in C#
var keyword in Foreach Statement in C#
Below is a sample sourcecode demonstrating the usage of the var keyword within the indexes in the Foreach statement in c#. var keyword in Foreach Statement in C#