`
fullfocus
  • 浏览: 100697 次
  • 来自: 厦门
最近访客 更多访客>>
社区版块
存档分类
最新评论

c#学习读书笔记《1》

    博客分类:
  • .net
阅读更多

1.设置环境变量: path =C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

2.helloworld.cs 第一个程序

namespace InsideCSharp
{
    class HelloWorldConsoleApp
    {
        static void Main()
        {
            System.Console.WriteLine("hello,world");
        }
    }
}

cmd-->  csc helloworld.cs   -->helloworld.exe

namespace 可以嵌套

被引用时用  using A;   但是当引用多个名称空间时,类不能有歧义。可以完全限定。

3。了解底层代码MSIL

用dumpbin.exe实用程序查看(^^据说业界都用这个看二进制代码的内部)(在C:\Program Files\Microsoft Visual Studio 8\VC\bin下)

CMD-->dumpbin  /HEADERS /CLRHEADER helloworld.exe

//*******************************ji

 E:\study\2006\c#>dumpbin /headers /clrheader helloworld.exe
Microsoft (R) COFF Binary File Dumper Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

DUMPBIN : warning LNK4044: unrecognized option "clrheader"; ignored

Dump of file helloworld.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
             14C machine (i386)
               3 number of sections
        44708882 time date stamp Sun May 21 23:34:26 2006
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
             10E characteristics
                   Executable
                   Line numbers stripped
                   Symbols stripped
                   32 bit word machine

OPTIONAL HEADER VALUES
             10B magic #    //表明确实是一个合法的PE
            8.00 linker version
             400 size of code
             600 size of initialized data
               0 size of uninitialized data
            234E RVA of entry point
            2000 base of code
            4000 base of data
          400000 image base
            2000 section alignment
             200 file alignment
            4.00 operating system version
            0.00 image version
            4.00 subsystem version
               0 Win32 version
            8000 size of image
             200 size of headers
               0 checksum
               3 subsystem (Windows CUI)
             400 DLL characteristics
                   RESERVED - UNKNOWN
          100000 size of stack reserve
            1000 size of stack commit
          100000 size of heap reserve
            1000 size of heap commit
               0 loader flags
              10 number of directories
               0 [       0] RVA [size] of Export Directory
            2300 [      4B] RVA [size] of Import Directory
            4000 [     2B0] RVA [size] of Resource Directory
               0 [       0] RVA [size] of Exception Directory
               0 [       0] RVA [size] of Certificates Directory
            6000 [       C] RVA [size] of Base Relocation Directory
               0 [       0] RVA [size] of Debug Directory
               0 [       0] RVA [size] of Architecture Directory
               0 [       0] RVA [size] of Special Directory
               0 [       0] RVA [size] of Thread Storage Directory
               0 [       0] RVA [size] of Load Configuration Directory
               0 [       0] RVA [size] of Bound Import Directory
            2000 [       8] RVA [size] of Import Address Table Directory
               0 [       0] RVA [size] of Delay Import Directory
            2008 [      48] RVA [size] of Reserved Directory
               0 [       0] RVA [size] of Reserved Directory


SECTION HEADER #1
   .text name
     354 virtual size
    2000 virtual address
     400 size of raw data
     200 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         Execute Read

SECTION HEADER #2
   .rsrc name
     2B0 virtual size
    4000 virtual address
     400 size of raw data
     600 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

SECTION HEADER #3
  .reloc name
       C virtual size
    6000 virtual address
     200 size of raw data
     A00 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
42000040 flags
         Initialized Data
         Discardable
         Read Only

  Summary

        2000 .reloc
        2000 .rsrc
        2000 .text
//********************************

为了研究c#和.net元素如何实现,用Framework SDK中的反汇编工具,ILDASM.

(ildasm.exe: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin)

其他还有配件(assembly),模块,构建配件,创建共享配件,使用全局配件缓存等内容,在此不再祥述^^



 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics