Category: C#
How to Use the Conditional Operator (?) in C# ?
Conditional Operator is also called as ternary operator which lets the developers to select between 2 values with a statement. Assume that you have to check for a number if it is even , we generally tend to use the if else statement . The same can be achieved using the ternary operator in C#. How to Use the Conditional Operator (?) in C# ?…
C# Compiler Error – CS1521 invalid base type
In this blog post, you’ll learn more about the C# Compiler Error – CS1521 and the related message description C# Compiler Error Code CS1521 C# Compiler Description for the Code :CS1521 Invalid base type
C# Compiler Warning – CS8885 the ‘this’ object cannot be used before
In this blog post, you’ll learn more about the C# Compiler Warning – CS8885 and the related message description C# Compiler Warning Code CS8885 C# Compiler Description for the Code :CS8885 The ‘this’ object cannot be used before all of its fields have been assigned
How to Get the Top 5 elements from a List in C# ?
If you want to get the top 5 elements from a list in C# or skip the first item and get the next five elements from a List , you can use the Take and the Skip methods. How to Get the Top 5 elements from a List in C# ? Below is a sample code snippet demonstrating the usage of the Skip and Take…
Upgrading Windows Phone 7.5 App to Windows Phone 8 in Visual Studio 2012.
If you want to utilize the capabilities or the features of Windows Phone 8 in your Windows Phone 7.5 project, you might need to upgrade it to Windows Phone 8. Once you upgrade your Windows Phone 7.5 project to Windows Phone 8, you cannot revert back and hence it always better to copy/backup your Windows Phone 7.5 project before upgrading. Upgrading Windows Phone 7.5 App…
C# Compiler Error – CS4021 the callerfilepathattribute may only be
In this blog post, you’ll learn more about the C# Compiler Error – CS4021 and the related message description C# Compiler Error Code CS4021 C# Compiler Description for the Code :CS4021 The CallerFilePathAttribute may only be applied to parameters with default values
C# Compiler Warning – CS8778 constant value ‘{0}’ may overflow ‘{1}’
In this blog post, you’ll learn more about the C# Compiler Warning – CS8778 and the related message description C# Compiler Warning Code CS8778 C# Compiler Description for the Code :CS8778 Constant value ‘{0}’ may overflow ‘{1}’ at runtime (use ‘unchecked’ syntax to override)
C# Compiler Error – CS0750 a partial method cannot have the ‘abstra
In this blog post, you’ll learn more about the C# Compiler Error – CS0750 and the related message description C# Compiler Error Code CS0750 C# Compiler Description for the Code :CS0750 A partial method cannot have the ‘abstract’ modifier
C# Compiler Error – CS1601 cannot make reference to variable of typ
In this blog post, you’ll learn more about the C# Compiler Error – CS1601 and the related message description C# Compiler Error Code CS1601 C# Compiler Description for the Code :CS1601 Cannot make reference to variable of type ‘{0}’
C# Compiler Error – CS8664 ‘{0}’: ‘readonly’ can only be used on ac
In this blog post, you’ll learn more about the C# Compiler Error – CS8664 and the related message description C# Compiler Error Code CS8664 C# Compiler Description for the Code :CS8664 ‘{0}’: ‘readonly’ can only be used on accessors if the property or indexer has both a get and a set accessor
C# Compiler Error – CS0525 interfaces cannot contain instance field
In this blog post, you’ll learn more about the C# Compiler Error – CS0525 and the related message description C# Compiler Error Code CS0525 C# Compiler Description for the Code :CS0525 Interfaces cannot contain instance fields
C# Compiler Error – CS8086 a ‘{0}’ character must be escaped (by do
In this blog post, you’ll learn more about the C# Compiler Error – CS8086 and the related message description C# Compiler Error Code CS8086 C# Compiler Description for the Code :CS8086 A ‘{0}’ character must be escaped (by doubling) in an interpolated string.
How to Sort Array Elements in Descending Order in C#?
The Array class includes static method called Sort which can be used to sort the array in ascending order. After using the Sort method, one can use the Reverse method to sort the array back to descending order. How to Sort Array Elements in Descending Order in C#? Below is a sample code snippet demonstrating sorting of array elements in Descending order in C#.
C# Compiler Warning – CS0469 the ‘goto case’ value is not implicitly
In this blog post, you’ll learn more about the C# Compiler Warning – CS0469 and the related message description C# Compiler Warning Code CS0469 C# Compiler Description for the Code :CS0469 The ‘goto case’ value is not implicitly convertible to type ‘{0}’
C# Compiler Error – CS0006 metadata file ‘{0}’ could not be found
In this blog post, you’ll learn more about the C# Compiler Error – CS0006 and the related message description C# Compiler Error Code CS0006 C# Compiler Description for the Code :CS0006 Metadata file ‘{0}’ could not be found
C# Compiler Error – CS7088 invalid ‘{0}’ value: ‘{1}’.
In this blog post, you’ll learn more about the C# Compiler Error – CS7088 and the related message description C# Compiler Error Code CS7088 C# Compiler Description for the Code :CS7088 Invalid ‘{0}’ value: ‘{1}’.
How to convert JSON to XML or XML to JSON in C# ?
Below is a sample code snippet demonstrating how you can convert the Json to XML and vice versa in C# using Json.NET. How to convert JSON to XML or XML to JSON in C# ?
C# Compiler Error – CS0539 ‘{0}’ in explicit interface declaration
In this blog post, you’ll learn more about the C# Compiler Error – CS0539 and the related message description C# Compiler Error Code CS0539 C# Compiler Description for the Code :CS0539 ‘{0}’ in explicit interface declaration is not found among members of the interface that can be implemented
How to Get the Height and Width of the Page on changing orientation in Windows Phone?
Sometimes, you might want to determine the Height and Width of the Page in a Windows Phone app in order to adjust the screen and the UI elements in the Orientation changed event. The actual size of the page will not be modified until the OnOrientationChanged event is called and hence it is necessary to use the Dispatcher which lets you get the current height…
How to send email in ASP.NET MVC Web Application ?
The ASP.NET developers can use the Webmail class to send email in ASP.NET MVC Application. Below is a code sample to demonstrate sending email in ASP.NET MVC Razor View. How to send email in ASP.NET MVC Web Application ?