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

C#ÖÐÈçºÎÀí½â¡¾·´Éä¡¿¼¼Êõ

ÄãÊ×ÏÈÒªÀí½âһϸÅÄ
 Ò» ÀàÐÍ(Type) ¶ÔÏóÊÇʲô
±ÈÈç object x; xÊǶÔÏó£¬object¾ÍÊÇËüµÄÀàÐÍ£¬ÔÚ³ÌÐòÖÐÈçºÎÃèÊöÀàÐÍÕâ¸ö¸ÅÄîÄØ£¿
¾ÍÊÇType(System.Type)¡£Òª»ñȡij¸öÀàµÄÀàÐÍ¿ÉÒÔÓÃtypeof()²Ù×÷·û
 object a;object b; DataTable t;
aType = typeof(object);Type bType = typeof(object);tType = typeof(DataTable);
aType==bType!=tType;
¶þ ³ÌÐò¼¯(Assembly) ¾ÍÊÇÄãIDEÉú³ÉµÄ.exe»ò.dllÎļþµÄÔËÐÐʱ¾Í½Ð³ÌÐò¼¯¡£
ËùÓеĴúÂ붼ÔÚ³ÌÐò¼¯ÖС£Äã¿ÉÒÔͨ¹ýAssembly.Load()ϵÁк¯Êý¶¯Ì¬¼ÓÔسÌÐò¼¯£¨ÕâÒ»²½ÊǶ¯Ì¬£«ÔØ´úÂëµÄÇ°ÌᣬÒòΪËùÓеĴúÂ붼ÔÚ³ÌÐò¼¯ÖУ©¡£
 Èý ¶¯Ì¬¼ÓÔØ
ÎÒÃÇÆÕͨµ÷ÓôúÂëÊÇ: ¶ÔÏóÃû.·½·¨Ãû(²ÎÊýÁбí);
class a
{    void func(int x)
      {
      }
    public static void Main(string[] args)
     {
         //´´½¨¶ÔÏó a a1 = new a();
         //µ÷Óú¯Êý a1.func(1);
      }
 }
Ó÷´É䶯̬µ÷ÓôúÂëÊÇ
//¼ÓÔسÌÐò¼¯ System.Reflection.Assembly asm = Assembly.LoadFile(assemblyPath);
//»ñÈ¡ÀàÐÍ Type aType = asm.GetType("Ãû×Ö¿Õ¼ä.ÀàÃû");
//»ñȡûÓвÎÊýµÄ¹¹Ô캯Êý System.Reflection.ConstructorInfo conn = t.GetConstructor(new Type[0]);
//µ÷ÓÃûÓвÎÊýµÄ¹¹Ô캯Êý£¬Invoke·µ»ØobjectËüÆäÊÇaÀà object a1 = conn.Invoke(new object[0]);
 //»ñÈ¡²ÎÊýÀàÐÍΪint,º¯ÊýÃûΪfuncµÄ·½·¨ MethodInfo method = t.GetMethod("func",new Type[]{typeof(int)});
//ÔÚa1Éϵ÷ÓÃfunc·½·¨£¬²ÎÊýΪ1 method.Invoke(a1,new object[]{1});
 ¶¯Ì¬µ÷Ó㨺óÒ»ÖÖ·½·¨£©±È¾²Ì¬µ÷Óøü¸´ÔÓ£¬¶øÇÒЧÂÊ´ó¸ÅµÍ20±¶£¨ÍøÉÏÓиö¸çÃǺÃÏñ²âÊÔ¹ý£©¡£Ö»ÓÐÔÚÌØÊâµÄʱºò²Åµ÷Óö¯Ì¬¼ÓÔض¯Ì¬µ÷Óã­£­£­±ÈÈ磬ÄãµÄÖ÷³ÌÐòÆô¶¯µÄʱºò×ÓÄ£¿é»¹Ã»ÓУ¬Òª¸ù¾ÝµÇ½ÐÅÏ¢ÏÂÔØ×ÓÄ£¿é´úÂë²¢µ÷ÓÃ×ÓÄ£¿é´úÂ룬¾ÍÖ»ÄÜÓö¯Ì¬£«ÔØÀ´ÊµÏÖÁË.
ËÄ ÔªÊý¾Ý .netÉú³ÉµÄIL´úÂëÖбêÃ÷ÁËÔÚÕâ¸ö(exe,dll)ÎļþÖÐËùÓеÄclass(Àà) method£¨·½·¨£©Attribute£¨ÊôÐÔ£© Property£¨ÀàÊôÐÔ£©µÄÇ©ÃûºÍµ÷Ó÷½·¨ÐÅÏ¢£¬ÕâЩÐÅÏ¢¾Í½Ð×öÔªÊý¾Ý¡£ËùνµÄReflection·´É䣬¾ÍÊÇÀûÓÃÔªÊý¾Ý£¬¿


Ïà¹ØÎĵµ£º

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


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

C#´ò°üSQLÊý¾Ý¿â²¿Êð°²×°


²Î¿¼¡¶ASP.NETÓëSQLÒ»Æð´ò°ü²¿Êð°²×°¡·
£¬ÕâƪÎÄÕÂÊÇÕë¶ÔVB.NETÓëSQL Ò»Æð´ò°üµÄ,µ«ÊÇÎÒʹÓõÄÊÇC#,µ±È»Ö»ÒªÐÞ¸ÄÒ»ÏÂÖ÷Òª°²×°Àà¿â¾ÍÐÐÁË!C#µÄÀà¿â´úÂëÈçÏÂ:DBCustomAction.cs
using System;
using System.Collections;
using System.Data.SqlClient;
using System.ComponentModel;
using System.Configuration.Inst ......

ÔÚC#.netÖÐÈçºÎ²Ù×÷XML


ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйýXML²Ù×÷,Ï£ÍûÏÂÃæÕâƪÎÄÕÂÄܶԴó¼ÒÓаïÖú.»òÕß×Ô¼º¸´ÖÆһϴúÂëÊÔÒ»ÏÂ.ÕâƪÎÄÕ²»ÊÇÎÒдµÄ.ÎÒÖ»ÊÇת¹ýÀ´.¾õµÃ²»´í.
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlele ......

C# ίÍеÄÃîÎÄ¡¾×ª¡¿

ίÍкÍʼþÔÚ .Net FrameworkÖеÄÓ¦Ó÷dz£¹ã·º£¬È»¶ø£¬½ÏºÃµØÀí½âίÍкÍʼþ¶ÔºÜ¶à½Ó´¥C#ʱ¼ä²»³¤µÄÈËÀ´Ëµ²¢²»ÈÝÒס£ËüÃǾÍÏñÊÇÒ»µÀ¼÷¶ù£¬¹ýÁËÕâ¸ö¼÷µÄÈË£¬¾õµÃÕæÊÇÌ«ÈÝÒ×ÁË£¬¶øûÓйýÈ¥µÄÈËÿ´Î¼ûµ½Î¯ÍкÍʼþ¾Í¾õµÃÐÄÀï±ð£¨bi裩µÃ»Å£¬»ìÉí²»×ÔÔÚ¡£±¾ÎÄÖУ¬ÎÒ½«Í¨¹ýÁ½¸ö·¶ÀýÓÉdzÈëÉîµØ½²ÊöʲôÊÇίÍС¢ÎªÊ²Ã´ÒªÊ¹Ó ......

Observer ¹Û²ìÕßģʽ £¨HeadFirstÉè¼Æģʽ c#£©

Observer.cs
using System;
using System.Text;
using System.Collections.Generic;
namespace Observer
{
   
    public interface ISubject
    {
        void RegisterObserver(IOvserver o);
    & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ