Posts
Data Type Conversions in C# with real time example
- Get link
- X
- Other Apps
In This Post We Will Learn Data Type Conversions 1. Implicit Conversions 2. Explicit Conversions 3. Different between Parse() and TryParse() Implicit Conversion is done by the compiler 1. When there is no loss of information if the conversion is done 2. if there is no possibility of throwing exception during the conversion Example : Converting an int to a float will not loose any data and no Exception will be thrown, hence an implicit conversion can be done. using System; namespace Datatypes_conversion { class Program { static void Main(string[] args) { // Implicit Convertion Real Time Example int r = 100; float m = r; ...
Nullable Type In C# with Example
- Get link
- X
- Other Apps
IN THIS POST WE WILL LEARN 1. NULLABLE TYPE IN C# 2. NULL COALESCING OPERATOR ?? Type in C# In C# types are divided into 2 broad Categories Reference Types : Interface , Class , Delegates , Arrays E.t.c Value Types : Int , Float , Double , Structs ,Enums E.t.c By Default value types are non nullable. To make then nullable Use ? int r= 0 (r is non nullable, so r cannot be set null , r= null will generate Error ) int? m =0 (m is nullable int , so m=null is legal) Example : Nullable Type In C# using System; namespace NullableTypeInCshape { class Program { static void Main(string[] args) { bool? AreYouvirgin = true; if (AreYouvirgin ==true) ...
Basic -C# Reading and writing to a console
- Get link
- X
- Other Apps
* Reading From the Console * Writing to the Console * Two Ways To Write Console 1) Concatenation 2) Place Holder Syntax Reading and Writing to Console using System; // A Namespace is used to Organize your code and is Collection of Classes class Program { static void Main() // Main Methods { // Prompt The User For His First Name Console.WriteLine("Enter First Name"); // Read the name from Console string firstname = Console.ReadLine(); // Prompt the User For His Last Name ...
CREATING INTERNET APPLICATION PROJECT & MVC USING DATA BASE FIRST APPROACH
- Get link
- X
- Other Apps
In this we are going to see about how to create a project in visual studio and the concept of mvc. Here in this demo we are creating internet application base project. Step 1: Open the Microsoft Visual Studio. Go to File in that go to new and select Project. In new project select Visual C# , In that select ASP.NET MVC 4 Web Application. After selecting the project type give the name of the project and the desired location where you want to save your project and press ok. In my case I am giving my project name as my first project. After pressing ok a page will appear for selecting template to which we want to run our project. Here we are selecting our template as Internet Application. Internet Application is a account controller that uses forms and authentication. Our view engine will be Razor. After pressing ok project is generated. Now let us see about MVC (MODEL VIEW CONTROLLER). Model : It should be responsible for the data of a...