Category: C#

Cross-Platform Conditional Compilation Symbol for Windows Phone

There are times when you want to build an app targeting different platforms in Windows using the conditional compilation with pre-processor directives. Cross-Platform Conditional Compilation Symbol for Windows Phone If you are targeting the Xbox platform, one may use the pre-processor directive XBOX, similarly if you are targeting the Windows Phone platform , you can use the WINDOWS_PHONE pre-processor directive as shown below. #if WINDOWS_PHONE…

out keyword in c#

You can use the keyword out in c# to pass the arguments by reference . The out keyword works almost the same as ref keyword but one of the difference between the out and ref keyword is that out doesn’t require the variable to be initialized where as the ref keyword requires that the variable be initialized before passing it to the function. Below is…

Exception from HRESULT: 0x800455BC Error when using SpeechRecognizer in WP8

When using the SpeechRecognizerUI in your windows phone 8 app, there are times when you receive the “Exception from HRESULT: 0x800455BC Error”. The outcome of this error is “When you call the SpeechRecognizerUI’s RecognizeWithUIAsync() method , it displays a dialog for few seconds and then disappears immediately. When you debug the app, you will find the error “Exception from HRESULT: 0x800455BC ” with the stack…

How to Download Web Content synchronously in C# ?

If you need to download the web content synchronously using C# , you can use the WebClient class that is defined in the System.Net namespace. Below is a sample code snippet demonstrating how to download web content synchronously in c#. How to Download Web Content synchronously in C# ? The output file is generally saved in the same folder where the exe exists.

C# Compiler Warning – CS8634 the type ‘{2}’ cannot be used as type pa

In this blog post, you’ll learn more about the C# Compiler Warning – CS8634 and the related message description C# Compiler Warning Code CS8634 C# Compiler Description for the Code :CS8634 The type ‘{2}’ cannot be used as type parameter ‘{1}’ in the generic type or method ‘{0}’. Nullability of type argument ‘{2}’ doesn’t match ‘class’ constraint.

C# Compiler Warning – CS1066 the default value specified for paramete

In this blog post, you’ll learn more about the C# Compiler Warning – CS1066 and the related message description C# Compiler Warning Code CS1066 C# Compiler Description for the Code :CS1066 The default value specified for parameter ‘{0}’ will have no effect because it applies to a member that is used in contexts that do not allow optional arguments

Can we develop Windows Phone 8.1 App using HTML5 , JavaScript and CSS ?

Most of the developers with the web development skills might be keen to know if they can use their existing web development skills (HTML , JavaScript and CSS) to build Windows Phone 8.1 App . Can we develop Windows Phone 8.1 App using HTML5 , JavaScript and CSS ? Yes , you can develop Windows Phone 8.1 App using HTML5 , JavaScript and CSS ….

C# Program to display "Hello, World!"

Problem Write a program in C# to display “Hello, World!” on the screen. C# Program to display “Hello, World!” in Console Window. This is a simple C# program that displays “Hello, World!” on the console window. Output Hello, World!

How to Generate C# class from a XML file ?

Do you want to generate C# class from an XML file ?. You can use the xsd tool to do it. How to Generate C# class from a XML file ? 1. Just launch the Visual Studio Developer Command prompt from the Windows Start menu. 2. Type the command xsd and specify the path of the xml file. xsd d:\test\test.xml 3. This will create the…

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…