ASP. net mvc 4.0 learning 1-C # basic syntax,

Source: Internet
Author: User

ASP. net mvc 4.0 learning 1-C # basic syntax,

1. There are multiple operators in the method, and the same method name is used. Different numeric types and data volumes

Class Program {static void Main (string [] args) {Program newObject = new Program (); // string Console. writeLine (newObject. cal ("44", "13"); // Decimal Console. writeLine ("result of adding data:" + newObject. cal (44, 13); Console. read () ;}// method OverLoad decimal Cal (decimal x, decimal y) {return (x + y);} string Cal (string x, string y) {return ("string addition Result:" + (x + y ));}}

2. Inheritance and Override)

Inheritance: A class does not assume another class, and sub-classes have parent classes and methods. When the class name is specified, the class name is directly added after the class name (:), and then the parent class name is specified.

Override: the Virtual definition method is used in the parent class to indicate that this method can be overwritten. The Child class uses Override to record or modify the commitment method.

Class Program {static void Main (string [] args) {int x, y, result; Console. writeLine ("Please partition the number"); x = int. parse (Console. readLine (); Console. writeLine ("Please partition data"); y = int. parse (Console. readLine (); MyAdd newObject = new MyAdd (); result = newObject. cal (x, y); Console. writeLine ("Calculation result: \ n {0}/{1} = {2}", x, y, result); Console. readLine () ;}// parent class public class MyCal {// virtual method public virtual int Cal (int x, int y) {return x * y ;}} // sub-class public class MyAdd: MyCal {// Override indicates the Virtual method of the parent class public override int Cal (int x, int y) {return (x/y );}}}

3. Interface)

An interface is an abstraction. An interface class only contains the semantics of semantics and methods.

Class Program {static void Main (string [] args) {// define the car Car car = new Car (); // convert the car into IMove Im = (IMove) car; Im. move (); Console. readLine () ;}// parent class, defining interface public interface IMove {void Move () ;}// subclass, realizing interface public class Car: IMove {// public void Move () {Console. writeLine ("car moving ");}}}

 

Concept:

1,. NET Framework

The. NET Framework has two main parts: 1. The Common Language Runtime (CLR), which is the Runtime environment and engine of. NET programs.

2. Framework classification, which is composed of many existing API types. developers can directly use

2. ASP. NET

ASP. NET is A. NET application. This technology is mainly used in WEB development. ASP. NET uses the class libraries provided by. NET Framework.

3. Relationship between the two

. NET Framework is ASP. NET, ASP. NET is a kind of Web development technology, ASP. NET producer.. NET Framework.. NET Framework

 


How to further learn about aspnet (MVC)

You are a newbie to learn. NET
Learn MVC again
If you are a newbie to learn. NET and a newbie to learn mvc, it may be different.
If you want to learn. Net to the framework and design mode stage
We recommend that you learn MVC
If not. Net

Differences between several controllers in aspnet MVC40

Www.cnblogs.com/..w.html
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.