Visual Studio를 사용할경우 snippet파일을 직접 만들어서 적용.
Snippet을 적용하여 작업하는 이유는 모든 스크립트의 전체적으로 통일된 디자인을 적용하고 반복되어지는 작업을 최소화 시켜줌.
How to use.
아래처럼 xml형식으로 snippet 파일을 생성후 저장(*.snippet)으로 저장 하여야 한다.
(아래 형식은 제가 사용하는(unity)에서 형식이고 내용은 필요한대로 편집하여 사용하시면됩니다.)
저장경로 : Users\User\Documents\Visual Studio XXXX\Code Snippets\Visual C#\My Code Snippets
그 이후
프로젝트에서 우클릭-> Insert Code Snippet -> My Code Snippet -> 해당 Snippet 선택
해주시면 snippet이 짠 하고 나타나는것을 보실수 있습니다.
ctrl + K + X가 Hotkey이니 애용하시면 될듯합니다. -End.
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>#Classregion</Title>
      <Shortcut>#Classregion</Shortcut>
      <Description>Code snippet for #Classregion</Description>
      <Author>Author Name</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>name</ID>
          <ToolTip>Region name</ToolTip>
          <Default>MyRegion</Default>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[
        #region -------Public Field-------
        $selected$ $end$
        #endregion
    
        #region -------Private Field-------
        $selected$ $end$
        #endregion
    
        #region -------Default Method-------
        $selected$ $end$
        #endregion
        #region -------Public Method-------
        $selected$ $end$
        #endregion
    
        #region -------Private Method-------
        $selected$ $end$
        #endregion
    
        #region -------Property-------
        $selected$ $end$
        #endregion
    ]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
 
 
 
 
0 개의 댓글:
댓글 쓰기