Tag: How to

How to open Documents folder from Run Window in Windows 10 ?

You can open the documents folder from the Run Windows in Windows 10 using the command “Documents”. How to open Documents folder from Run Window in Windows 10 ? Just open the Run window using the shortcut key (Windows + R) and type “Documents” and press the enter key. This should open up the documents folder or directory in Windows 10.

C Program to calculate the sum of Natural Numbers

Problem Write a program in C to take the input (n) from the user and calculate the sum of all the natural numbers from 1 to n. How to calculate the sum of natural numbers in C language ? Output Abundantcode.com coding sample                                                Enter a positive number : 4                                                 Result = 10

How to find if the request is from Ajax in ASP.NET MVC?

It is easy to find out if the actual request came from Ajax or is it a normal request in ASP.NET MVC. In the controller, one can use the Request.IsAjaxRequest method to find this. How to find if the request is from Ajax in ASP.NET MVC? Below is a sample code snippet demonstrating how to find if the request is from Ajax in ASP.NET MVC?

How to Create a Class in Javascript in WinJS ?

You can define a new class using WinJS.class.define when developing Windows Store App using Javascript. How to Create a Class in Javascript in WinJS ? The WinJS.Class.define method can be used to create a new class in WinJS  . It accepts 3 parameters – Constructor – instanceMembers – staticMembers Below is a sample code snippet demonstrating the usage WinJS.Class.define to create a new class in…

Auto-Property Initializers with Method Call in C# 6.0

The Auto-Property Initializer in C# 6.0 is a feature that lets the users to initialize the value of the auto implemented property . This feature lets the user provide any expression (lambda expression or a method) . Auto-Property Initializers with Method Call in C# 6.0 The below code snippet demonstrates how to initialize the auto property with a method call.

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 first number : 1                                                                                                                                                            Enter second number : 2                                                                                                                                                                  1 + 2 = 3

Displaying data in flat list in Windows Phone 8 LongListSelector Control

Below is a sample code snippet demonstrating the display of the flat list in the Windows Phone 8 LongListSelector Control. Displaying data in flat list in Windows Phone 8 LongListSelector Control LongListSelector Declaration <phone:LongListSelector Name=”lstWebsites” HorizontalAlignment=”Left” VerticalAlignment=”Top” LayoutMode=”List” IsGroupingEnabled=”False” Width=”446″> <phone:LongListSelector.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text=”{Binding Name}” /> </StackPanel> </DataTemplate> </phone:LongListSelector.ItemTemplate> </phone:LongListSelector> Model public class WebsiteName { public string Name { get; set; } public int…

How to remove the non ascii characters from a string in C# ?

Regular expression comes in handy especially if you want to remove the non ascii characters from a string in C#. Here’s a regular expression sample in C# demonstrating how to do it. How to remove the non ascii characters from a string in C# ? The output of the code snippet will be cde in C#

How to Generate Links to Action Method in different Areas in ASP.NET MVC?

The ActionLink helper method has 9+ overloads to generate links based on various scenarios. Generally, the “Action Name” is passed as the 2nd parameter to the ActionLink which points to the current Controller and the specified Action method. What do we do when the Action method of a different Area needs to be refereed to when generating the link in ASP.NET MVC? How to Generate…

Column Alias in SQL Query

When returning the query results , you want to provide an alternate name for the column for readability purpose , you can use the AS clause to specify the column alias in SQL Query. How to specify Column alias in SQL Query ? Below is an example of the usage of the column alias in SQL Query. Every column in the Query result has a…

How to Implement Interfaces in C# ?

Once the interface is created or available , you might want to implement the functionality of the interface in your class . How to Implement Interfaces in C# ? To implement an interface , we must declare and provide implementations for each functions in your class. Below is a sample code snippet that demonstrates how to implement interface in C#.

How to Create Extension Method in C# ?

Extension methods are great way to add a method to an existing type . A typical scenario is when you dont have the access to the sourcecode and want to add a method to the type . How to Create Extension Method in C# ? Below is a sample code snippet that demonstrates how to create an extension method for the integer type to tell…