Boxing and Unboxing in C#

Filed in C#Tags: , , , ,

The two terms Boxing and Unboxing in C# are used when we need to convert one data type to other type. First we will discuss the Boxing. Boxing is the process of converting a Value type to the other Object type. When we use the Boxing of a value type to an objtct type the CLR wraps its value inside System.Object and stores it on the managed heap. In the term unboxing we perform reverse of boxing. In unboxing the value of an object type extracts and converted into value type. Boxing is an implicit process so we need not to write any code to box a value type. But in case of unboxing we need to do it explicitly,

Read the rest of this entry »

Namespace in C#.Net

Filed in ASP.NET, C#Tags: , , , , , , ,

Definition: As we know that every piece of code in .Net exists inside a .Net Type. Generally we put the code inside the class. The namespace is a collection of these classes or types. Every type exists inside a namespace. Namespaces can organize all the different types in the class library. Without namespace, these types would be grouped into a single long and messy list. In .Net the System namespace is stocked with several hundred classes. Also many namespaces are exists inside the System namespace. There are many namespaces that are must while developing a .Net application.

Read the rest of this entry »

C#.NET – Creating DLL to Hide Your Code

Filed in ASP.NET, C#Tags: , , , , , ,

The DLL also called Dynamic Link Library is a file that can be used dynamically by other programs. We create the DLL mainly to hide our confidential code so that we can use the code everywhere but can not see the code. When we talk about the layers or 3 and above tier application we need to understand one thing that why we create layers in our project. We only show some part of code to everyone and hide the main coding part. The benefit is we can use this code but can not see this.

Read the rest of this entry »

C# Switch Case Statement

Filed in C#Tags: , , ,

As we know that we use If-Else statement when we have to perform any conditional bases operation. When the condition become true we execute the If block statements and when the condition is false we execute Else block. But sometimes there are a group of conditions where we have to perform one from the group. In this case we use Switch-Case statements. A Switch statement execute the case condition corresponding to the value of expression. First we will use the syntax of using Switch-Case Example. and Then we will use an example.

Read the rest of this entry »

Java Good: Advantages of using Java architecture

Filed in Uncategorized

The famous Java programming language was born out of necessity: the high-level programming language was designed to make object-oriented programming easier. Aside from being a programmer-friendly and relatively easy computing language, people can also share sets of codes with other programmers in an open-source library in different formats such as source codes (.java) or compiled codes (.class). While there are newer and more advance programming languages that just emerged for every programmer’s perusal, Java still remained significant and one of the best coding languages available to everyone. If you are not convinced with the simplicity and enormity Java has to offer, here are some tips why you have to switch to Java now:

Read the rest of this entry »

How to Extract a URL’s Title, Description and Images using HTML Agility Utility

Filed in ASP.NET, Web AppTags: , , , , , , , ,

Extracting the details from any web page URL is not so easy task. Because you need something to track that page. In this article we are going to extract the details like Title, Description and collection of Images. To do this we need HTML Agility Utility in our web application. When we share a link on Facebook or Google+ we see that the Image and description comes automatically after few seconds. Exactly they have coding to perform this. As we will proceed in this article we will learn step by step to do this. I am attaching a link to download the HTML Agility Utility and also the demo project that you can download on your PC for reference.

Read the rest of this entry »

How to Get Connection String from App.config in .Net Application

Filed in Desktop AppTags: , , , , ,

Hello guys,

As we know that while interacting our SQL database to our C#.net or VB.net application we need to access the connectionstring of the SQL database. Once we access the connectionstring then we can use this to execute the SQL commands in our coding page. Now the question is when we have multiple forms in our desktop application we need to write the connectionstring on each window form to access the SQL database. So guys what to do to ignore this multiple writing of connectionstring on each form?  To avoid this we use an app.config file into our desktop application as we use the web.config file in web application. As we describe our connectionstring once in this app.config file we can access this connectionstring multiple times on multiple forms from app.config file. in this article we will tell you the process to access this.

Read the rest of this entry »

How to use SQL Commands in C#.NET

Filed in ASP.NET, SQLTags: , , , , , , , , , ,

In this article we will see that how can use and execute the SQL Commands in Visual Studio. In this article we are using C# language. As we proceed in this article you will see that what steps are required to perform this task. We need the two main classes to do this. These classes are SqlConnection and SqlCommand.  First we will use to include the namespaces that are required to using these two classes. First we will include two namespaces by using ‘using’ keyword. After importing this namespaces we will create the object for SqlConnection and SqlCommand.

Read the rest of this entry »

Using if-else Statement while Inserting the Record in SQL Server Database

Filed in SQLTags: , , , ,

Today we will learn that how to use an if-else statement while inserting records into the database. We are talking about the SQL Server database. To understand this example we are understanding a problem that will make easy to  learn if-else statement. Our problem is we want to insert a record into the table named “StudentRecord”. This table have two columns named ‘student_name’ and ‘student_gender’. We will pass the name and gender as parameter in the stored procedure. Now we have to edit the name according to his/her gender. for example if the student_gender = ‘Male’ then we will add ‘Mr.’ before the name of student. Similarly if the student_gender = ‘Female’ then we will add ‘Mrs/Miss’ before the name of student. Now we are showing that how this task will be done.

Read the rest of this entry »

The Common Type System and the Data Type that .Net Uses

Filed in ASP.NETTags: , , , ,

Because the .NET framework supports multiple languages within the platform, it defines a Common Type System (CTS). The CTS defines the basic data types that IL understands. Each .NET compliant language should map its data type to these standard data types. This makes it possible for the 2 languages to communicate with each other by passing/ receiving parameters to and from each other. For example: CTS defines a type, Int32, as integral data type of 32 bits (4 byte) which is mapped by C# through int and VB.net through its Integer data type.

Read the rest of this entry »