Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#ÖнṹÓëÀàµÄÇø±ð

Ò»£®ÀàÓë½á¹¹µÄʾÀý±È½Ï£º
½á¹¹Ê¾Àý£º
public struct Person
{
string Name;
int height;
int weight
public bool overWeight()
{
//implement something
}
}
ÀàʾÀý£º
public class TestTime
{
int hours;
int minutes;
int seconds;
public void passtime()
{
//implementation of behavior
}
}
µ÷Óùý³Ì£º
public class Test
{
public static ovid Main
{
Person Myperson=new Person //ÉùÃ÷½á¹¹
TestTime Mytime=New TestTime //ÉùÃ÷Àà
}
}
´ÓÉÏÃæµÄÀý×ÓÖÐÎÒÃÇ¿ÉÒÔ¿´µ½£¬ÀàµÄÉùÃ÷ºÍ½á¹¹µÄÉùÃ÷·Ç³£ÀàËÆ£¬Ö»ÊÇÏÞ¶¨·ûºóÃæÊÇ struct »¹ÊÇ class µÄÇø±ð£¬¶øÇÒʹÓÃʱ£¬¶¨ÒåеĽṹºÍ¶¨ÒåеÄÀàµÄ·½·¨Ò²·Ç³£ÀàËÆ¡£ÄÇôÀàºÍ½á¹¹µÄ¾ßÌåÇø±ðÊÇʲôÄØ£¿
¶þ .ÀàÓë½á¹¹µÄ²î±ð
1. ÖµÀàÐÍÓëÒýÓÃÀàÐÍ
½á¹¹ÊÇÖµÀàÐÍ£ºÖµÀàÐÍÔÚ¶ÑÕ»ÉÏ·ÖÅäµØÖ·£¬ËùÓеĻùÀàÐͶ¼ÊǽṹÀàÐÍ£¬ÀýÈ磺int ¶ÔÓ¦System.int32 ½á¹¹£¬string ¶ÔÓ¦ system.string ½á¹¹ £¬Í¨¹ýʹÓýṹ¿ÉÒÔ´´½¨¸ü¶àµÄÖµÀàÐÍ
ÀàÊÇÒýÓÃÀàÐÍ£ºÒýÓÃÀàÐÍÔÚ¶ÑÉÏ·ÖÅäµØÖ·
¶ÑÕ»µÄÖ´ÐÐЧÂÊÒª±È¶ÑµÄÖ´ÐÐЧÂʸߣ¬¿ÉÊǶÑÕ»µÄ×ÊÔ´ÓÐÏÞ£¬²»Êʺϴ¦Àí´óµÄÂß¼­¸´ÔӵĶÔÏó¡£ËùÒԽṹ´¦Àí×÷Ϊ»ùÀàÐͶԴýµÄС¶ÔÏ󣬶øÀà´¦Àíij¸öÉÌÒµÂß¼­
ÒòΪ½á¹¹ÊÇÖµÀàÐÍËùÒԽṹ֮¼äµÄ¸³Öµ¿ÉÒÔ´´½¨ÐµĽṹ£¬¶øÀàÊÇÒýÓÃÀàÐÍ£¬ÀàÖ®¼äµÄ¸³ÖµÖ»ÊǸ´ÖÆÒýÓÃ
×¢£º
1.ËäÈ»½á¹¹ÓëÀàµÄÀàÐͲ»Ò»Ñù£¬¿ÉÊÇËûÃǵĻùÀàÐͶ¼ÊǶÔÏó£¨object£©,c#ÖÐËùÓÐÀàÐ͵ĻùÀàÐͶ¼ÊÇobject
2.ËäÈ»½á¹¹µÄ³õʼ»¯Ò²Ê¹ÓÃÁËNew ²Ù×÷·û¿ÉÊǽṹ¶ÔÏóÒÀÈ»·ÖÅäÔÚ¶ÑÕ»É϶ø²»ÊǶÑÉÏ£¬Èç¹û²»Ê¹ÓÓн¨”(new)£¬ÄÇôÔÚ³õʼ»¯ËùÓÐ×Ö¶Î֮ǰ£¬×ֶν«±£³Öδ¸³Öµ×´Ì¬£¬ÇÒ¶ÔÏ󲻿ÉÓÃ
2£®¼Ì³ÐÐÔ
½á¹¹£º²»ÄÜ´ÓÁíÍâÒ»¸ö½á¹¹»òÕßÀà¼Ì³Ð£¬±¾ÉíÒ²²»Äܱ»¼Ì³Ð£¬ËäÈ»½á¹¹Ã»ÓÐÃ÷È·µÄÓÃsealedÉùÃ÷£¬¿ÉÊǽṹÊÇÒþʽµÄsealed .
ÀࣺÍêÈ«¿ÉÀ©Õ¹µÄ£¬³ý·ÇÏÔʾµÄÉùÃ÷sealed ·ñÔòÀà¿ÉÒԼ̳ÐÆäËûÀàºÍ½Ó¿Ú£¬×ÔÉíÒ²Äܱ»¼Ì³Ð
×¢£ºËäÈ»½á¹¹²»Äܱ»¼Ì³Ð ¿ÉÊǽṹÄܹ»¼Ì³Ð½Ó¿Ú£¬·½·¨ºÍÀà¼Ì³Ð½Ó¿ÚÒ»Ñù
ÀýÈç:½á¹¹ÊµÏÖ½Ó¿Ú
interface IImage
{
void Paint();
}
struct Picture : IImage
{
public void Paint()
{
// painting code goes here
}
private int x, y, z; // other struct members
}
3£®ÄÚ²¿½á¹¹£º
½á¹¹£º
ûÓÐĬÈϵĹ¹Ô캯Êý£¬µ«ÊÇ¿ÉÒÔÌí¼Ó¹¹Ô캯Êý
ûÓÐÎö¹¹º¯Êý
ûÓÐ abs


Ïà¹ØÎĵµ£º

´òÔì×Ô¼ºµÄc#ÆÁÄ»±£»¤³ÌÐò(,Ô´Âë)

/**************************************************************************************************
*       ×÷Õßwenwenhua
*        
/* Program : A Simple Screen Saver
* File Name : ScreenSaver.cs
* Author : Tran Khanh Hien ......

asp.net(c#) Ë®ÏÉ»¨Êý

Ë®ÏÉ»¨Êý£ºÒ»¸öÈýλÕûÊý¸÷λÊý×ÖµÄÁ¢·½ºÍµÈÓÚ¸ÃÊý±¾Éí¾Í³Æ¸ÃÊýΪˮÏÉ»¨Êý£¬Ë®ÏÉ»¨Êý¹²ÓÐ4¸ö£¬·Ö±ðΪ£º153¡¢370¡¢371¡¢407( ÀýÈ磺1^3 + 5^3 + 3^3 = 153 )¡£ÎÒдµÄ´úÂëÈçÏ£¬ÄãÓÐÆäËûµÄʵÏÖ´úÂëÒ²¿ÉÒÔ·¢±íÆÀÂÛ¡£
int i, m,n,k;
for (i = 100; i < 1000; i++)
{
//È¡µÃ°ÙλÊý
m = i / 100;
//È¡µ ......

asp.net(c#) ·µ»ØÉÏÒ»Ò³

Õª³­Ç°±²ÃǵÄ
ÆäʵҪʵÏÖÕâ¸ö¹¦ÄÜÖ÷Òª»¹ÊÇÒªÓõ½javascript
·½·¨Ò»£º
ÔÚasp.netµÄaspxÀïÃæµÄÔ´´úÂëÖÐ
<input type="button onclick="javascript:window.history.go(-1);"value="·µ»ØÉÏÒ»Ò³">
dzÎö£ºÕâ¸öÊÇÓÃÁËHTML¿Ø¼þ£¬Í¨¹ýÒ»¸öonclickµÄʼþ£¬µ÷ÓÃÁËjavascriptÖеÄÒ»¸ö·½·¨¾Í¿ÉÒÔÁË¡£Õâ¸öÊÇ×î¼òµ¥µÄÁË£¬Ò²Í¬Ñù ......

asp.net(c#)»º´æCache¶ÔÏó£¨Ñ§Ï°ÈÕ¼ÇÒ»£©


ʲôÊÇCache¶ÔÏó?
ÄãÔÚÉú³É¸ßÐÔÄÜÍøÂçÓ¦ÓóÌÐòʱËùÓöµ½µÄÒ»¸öÎÊÌâ¾ÍÊÇÐèÒª±ÜÃâÖظ´¡£Ò»¸öCache¶ÔÏóÔÊÐíÔÚËüÃǵÚÒ»´Î±»ÇëÇóʱÔÚÄÚ´æÖлº´æÏȻºó½«±»»º´æµÄ¸±±¾ÓÃÓÚÒÔºóµÄÇëÇó¡£Ê¹Óñ»»º´æµÄ¸±±¾ÔÊÐíÄã±ÜÃâÖؽ¨Âú×ãÒÔÇ°ÇëÇóµÄÐÅÏ¢£¬ÌرðÊÇÄÇЩÿ´Î´´½¨Ê±¶¼ÐèÕ¼ÓÐÃ÷ʾµÄ·þÎñÆ÷ÉϵĴ¦ÀíÆ÷ʱ¼äµÄÃüÁî¡£
³ý»º´æ¸ö±ðÏÈç» ......

C#ÖÐC/C++³ÌÐòÔ±×¢ÒâÎÊÌâ

1¡¢C/C++³ÌÐòÔ±Çë×¢Ò⣬²»ÄÜÔÚcaseÓï¾ä²»Îª¿Õʱ“ÏòÏÂÖ´ÐД¡£
2¡¢ÖµÀàÐͺÍÒýÓÃÀàÐÍÖ®¼äµÄÇø±ð£ºC#µÄ»ù±¾ÀàÐÍ£¨int£¬charµÈ£©¶¼ÊÇÖµÀàÐÍ£¬ÊÇÔÚÕ»Öд´½¨µÄ¡£¶ø¶ÔÏóÊÇÒýÓÃÀàÐÍ£¬´´½¨ÓÚ¶ÑÖУ¬ÐèҪʹÓùؼü×Önew¡£
3¡¢ÔÚC#ÖÐͨ¹ýʵÀý·ÃÎʾ²Ì¬·½·¨»ò³ÉÔ±±äÁ¿ÊDz»ºÏ·¨µÄ£¬»áÉú³É±àÒëÆ÷´íÎó¡£µ«ÊÇÎÒÃÇ¿ÉÒÔͨ¹ýÉùÃ÷ËûÃÇ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ