Tag: How to

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

How to Update From Select Statement in SQL Server ?

Below is a sample query that demonstrates how to update a table by getting the data from the select query in SQL Server. Assume that there are 2 tables AbundantCodeEmployee and AbundantCodeDepartment which contains the id . The id(in department) in this example refers to the department head . The columns “DepartmentName” is updated in the query based on the value retreived  . How to Update From…

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#.

How to remove a column from an existing table in SQL Server?

Use the DDL (Data definition language) query to remove a column from an existing table in SQL Server. How to remove a column from an existing table in SQL Server? ALTER command will allow the user to remove a column from the table. Syntax to remove the column from the table. ALTER TABLE <tablename> DROP COLUMN <columnname>; For example , assume that you have a…

How to Disable Browser Link in Visual Studio 2015 ?

Browser Link is one of the cool features in Visual Studio for the ASP.NET Developers. Sometimes , the web developers might want to disable this feature for various reasons. How to Disable Browser Link in Visual Studio 2015 ? There are 2 ways in which you can disable the Browser link in Visual Studio 2015. 1. Using Web.config file Just set the property vs:EnableBrowserLink value…

Python Program to display "Hello, World!"

Problem Write a program in Python to display “Hello, World!” on the screen. Python Program to display “Hello, World!” in Console Window. This is a simple Python program that displays “Hello, World!” on the console window. Output Hello, World! The above Python program uses the print() function to display the Hello,World! string to the screen. Note that the strings are enclosed inside the single quotes…

Passing Parameters to the ActionLink in ASP.NET MVC

There are times when the parameter has to be passed along with the URL from an ActionLink control in ASP.NET MVC. This can be done easily using the anonymous type which can be passed as the third parameter for the ActionLink helper method. Passing Parameters to the ActionLink in ASP.NET MVC Below is a sample code snippet demonstrating how to pass values to the ActionLink…

How to Use the Null Coalescing Operator (??) in C# ?

There are times when you simply want to check if the value is null and perform some steps based on the condition . The Null Coalescing Operator (??) can help you achieve this. How to Use the Null Coalescing Operator (??) in C# ? Below is a sample code that uses Null Coalescing Operator (??) in C# to find if the vaklue is null ….

How to get the total number of items in a Enum in C# ?

If you want to get the total number of items that is defined in an enum using C# , you can use the Enum.GetNames static method combined with the Length property. How to get the total number of items in a Enum in C# ? Here’s a code sample demonstrating how to do it. This would display 3 in the console.

How to Access ModelState Property within the View of ASP.NET MVC ?

Most of the times , the ModelState property is used within the controller to verify if the model has valid data or not. But there are sometimes where you want to access the ModelState Property within the View in ASP.NET MVC Application. How to Access ModelState Property within the View of ASP.NET MVC ? If you need to access the ModelState property in the View…

How to Make Single Instance Application for VB.NET Application in Visual Studio 2012?

When developing a Windows Application in VB.NET, there are times when you want to make your application as single instance application. You can do that easily with just few steps in your VB.NET project. How to Make Single Instance Application for VB.NET Application in Visual Studio 2012? Launch Visual Studio 2012 and Open your VB.NET Windows Application. Right Click on the project in the Visual…

Sending SMS from a Windows Phone 8.1 App

Do you want to send SMS from your Windows Phone 8.1 App ? . You can use the ChatMessage class in Windows Runtime to do it. Sending SMS from a Windows Phone 8.1 App Here’s a code that demonstrates how to send SMS from a Windows Phone 8.1 App .

How to get the Number of Elements in an MultiDimensional Array in C# ?

In one of the previous articles , we demonstrated the usage of the Length property of the array in C# to get the number of elements in it. In this post , lets have a look at getting the number of elements in the multi-dimentional array in C#. How to get the Number of Elements in an MultiDimensional Array in C# ? If you wanted…