Tag: C#

How to Check Status of Current Thread in C# ?

This blog post will provide a simple tip on how you can find the status of the current thread in C# program. How to Check Status of Current Thread in C# ? The isAlive property can be used to check the current thread status in C#. First , get the instance of the current thread using the Thread.CurrentThread and then get the IsAlive property. Ensure…

How to Get the Path to special folder using C# ?

If you want to get the path to the special of the user like My Documents etc. , you can use the Environment.GetFolder with the enum “Environment.SpecialFolder”. How to Get the Path to special folder using C# ? Below is a sample code snippet demonstrating on how to do it.

How to Skip Iteration of a foreach loop in C# ?

When using C# programming language , there are times when you might want to skip over the iteration based on some condition and jump over to the next iteration. How to Skip Iteration of a foreach loop in C# ? continue keyword comes to your rescue for this use case. When you want to skip the processing of current iteration and jump to the next…

How to Convert a Byte Array to Integer in C# ?

To Convert a Byte array back to the integer , the developers can use the BitConverter.ToInt32 method which accepts byte array as input and returns the number . Below is a sample code snippet that demonstrates how to convert a byte array to integer in C#. How to Convert a Byte Array to Integer in C# ?

How to convert Nullable int to integer in C# ?

You can convert the Nullable Integer to Integer in C# using one of the below methods. 1. Using null-coalescing and default keyword 2. Using the GetValueOrDefault method. How to convert Nullable int to integer in C# ? Below is the sample code snippet demonstrating the usage of the default keyword and GetValueOrDefault method.

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 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…