2010-04-11 22 views

回答

5

當然,如果你在IL中寫的不是如果你用C#編寫的話。

+1

該死......這是很容易使用,在代碼片段 – 2010-04-11 20:32:18

2

這只是C#和IL之間的語法差異。在C#代碼中定義構造函數時,需要調出類名。你想要完成什麼?

+0

真的不能不屑於做這樣...... – 2010-04-11 20:34:26

+6

不能打擾鍵入類名,或回答?不能說我和你在一起。 – 2010-04-11 20:36:40

3

不要看到爲什麼你想要這個點。

你可以使用VS snippet ctor,你會得到一個免費的構造函數。

只需鍵入ctor並按Tab鍵兩次即可。

3

RE:

該死......它是非常容易使用 在代碼片段

這是爲Visual Studio代碼段?他們已經有一個叫做ctor的替代類名稱。如果你的默認行爲不是你想要的,你可以看看它的定義。

<?xml version="1.0" encoding="utf-8" ?> 
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> 
    <CodeSnippet Format="1.0.0"> 
     <Header> 
      <Title>ctor</Title> 
      <Shortcut>ctor</Shortcut> 
      <Description>Code snippet for constructor</Description> 
      <Author>Microsoft Corporation</Author> 
      <SnippetTypes> 
       <SnippetType>Expansion</SnippetType> 
      </SnippetTypes> 
     </Header> 
     <Snippet> 
      <Declarations> 
       <Literal Editable="false"> 
        <ID>classname</ID> 
        <ToolTip>Class name</ToolTip> 
        <Function>ClassName()</Function> 
        <Default>ClassNamePlaceholder</Default> 
       </Literal> 
      </Declarations> 
      <Code Language="csharp"><![CDATA[public $classname$() 
    { 
     $end$ 
    }]]> 
      </Code> 
     </Snippet> 
    </CodeSnippet> 
</CodeSnippets> 
相關問題