Tag: How to

How to return Http Status Code from ASP.NET Web API Controller ?

There are times when you might want to return the Http Status code from an action method of a ASP.NET Web Api Controller. One of the simplest way of doing this is using the CreateResponse method of the HttpRequestMessage as shown below. The sample below demonstrates how to return the status code 304 and 200 based on the last modified date of the employee record….

Creating Areas in ASP.NET MVC Application

The ASP.NET MVC Framework has the concept of “Areas” which allows the developers to organize the functional module of the web application. For Example, the modules like administration, student’s data, exam/test, results can be each area in the Application. The Area in the ASP.NET MVC project has a folder structure which includes controllers, views, Models etc. and allows the developers to keep them separate from…

C Program to count the number of digits in an Integer

Problem Write a program in C to cound the number of digits in an integer that was entered by the user. How to count the number of digits in an integer in turbo C ? Output Abundantcode.com Coding sample                                                   Enter an integer: 50102                                                Number of digits: 5

How to Not Allow Windows Phone devices to install App which don’t meet Requirements ?

There are times when you want to disable or not allows the Windows Phone devices to install the WP8 app that doesn’t meet the specific hardware requirements . How to Not Allow Windows Phone devices to install App which don’t meet Requirements ? You can do it by setting the requirements in the WMAppManifest.xml file. The Windows Phone Application manifest file includes a tab called…

How to delete folder from command line in Windows 10 ?

You can delete a directory or folder using the command “rmdir” from commandline in Windows 10. How to delete folder from command line in Windows 10 ? The syntax for deleting the folder in windows 10 is rmdir <name of the directory> Incase you want to delete the non-empty folder , you can use the parameter /s for the rmdir command. Below is an example…

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…

C# Program to add two integers

Problem Write a program in C# to add two integers and display the result on the screen. C# Program to add two integers Output Enter the first number1 Enter the second number2 result 3

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 create a file from a Command line in Windows 10 ?

There are two command that you can use to create a file from a command line in Windows 10. These include – echo – fsutil How to create a file from a Command line in Windows 10 ? The fsutil command can be used to create a file  by specifying the size but if you need to write a data to the file during its…

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…

C Program to check if a number is odd or even

Problem Write a program in C language to check whether a given number is even or odd. How to check if a Number is Odd or Even in C ? An integer that is divisible by 2 is an even number and that is not divisible by 2 is an odd number. Example of even number is 2 , 4, 12 etc. Example of an…

How to copy tables from a database to another in SQL Server ?

There are times when you may want to copy the tables from one database to another along with the data or import data along with the schema in SQL Server. One of the ways to do this is using the SQL Server Import/Export Wizard. How to copy tables from a database to another in SQL Server ? 1. Launch SQL Server Import and export wizard…

How to Debug a Windows Service written in C# ?

Debugging a Windows Service is one of the difficult thing to do when working on developing a Windows Service project in Visual Studio . One of the method to do the debugging is to attach the debugger to the thread and starting the Windows Service. . This might be little overhead sometimes. How to Debug a Windows Service written in C# ? Incase you need…

C Program to Swap two Numbers without using temporary variable

Problem Write a program in C language to swap two numbers without using temporary variable and display the result in the screen. How to Swap two numbers in C without using temporary variable? Output Abundantcode – Swap two numbers without using temporary variable  Enter First Number: 1                                Enter Second Number: 7                                  FirstNumber = 7.00                                   SecondNumber = 1.00