Writing a Chinese code program under. Net

Source: Internet
Author: User
Tags abstract table name access database
Program | Chinese to write Chinese code program under. Net



Zhengzo 2005-3-9



One year ago, when you were programming with an Access database, Through the Vs.net Data Designer wizard to generate the data-layer code, see the generated code, found that there are many Chinese, the original database in the table name and field name in Chinese, the program is running normally, check the relevant documents before you know the original vs.net default code is UTF-8. Not long ago in a blog to see speak easy language, so simply use vs.net to write some Chinese code to play, the result is as usual to write the program as no difference.



A little strange smell, so put the code out.



Using System;



Namespace Zhzuo.consoletest



{



Interface



The public interface can fly things



{



void Flight ();



}







Abstract class



Public abstract class Bird: something that can fly



{



Virtual method



Public virtual void Flight ()



{



Console.WriteLine ("Birds fly!");



}



Abstract properties



Public abstract String Name



{



Get



Set



}



Abstract methods



Public abstract string Gets the name of the Bird ();



}



Specific class



public class Hawk: Birds



{



private string variable 1;







Constructors



Public Hawk (string name)



{



Variable 1 = name;



}







public override string Name



{



Get{return variable 1;}



set{variable 1 = value;}



}







Overriding the base class method



public override void Flight ()



{



Console.WriteLine ("Eagle in Flight!");



}







public override string Gets the name of the bird ()



{



return variable 1;



}



}







Interface



Public interface plane: something that can fly



{



String type



{



Get



}



String gets the name ();



}







Specific class



Public class Fighter: airplane



{



public String type



{



get{return "aircraft type: Fighter";}



}







public string Get Name ()



{



return "fighter";



}







public void Flight ()



{



Console.WriteLine ("Fighter Flight");



}



}



public class Zzconsole



{



[STAThread]



static void Main (string[] args)



{



Bird a bird = new Eagle ("Gray Eagle");



Fighter One airplane = new fighter ();







Console.WriteLine (a bird. name);//Grey Eagle



A bird. Name = "Black Eagle";



Console.WriteLine (a bird. name);//Black Eagle



Console.WriteLine (a bird. Get the name of the Bird ());//Black Eagle







Console.WriteLine (a plane. type);//aircraft type: Fighter



Console.WriteLine (a plane. Get the name ());//Fighter







Flying objects = a bird;



Flying objects; Flying ()//Eagles flying!



Flying objects = an airplane;



Flying Objects-flight ()//Fighter flight



Console.ReadLine ();



}



}



}



Program operation is expected, everything is normal. Use Reflector.exe to view the following code:

The above is reflected into C #, the code that becomes vb.net,delphi.net or IL generates is similar. What would it be like to write a program in Chinese if you want to pervert it?


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.