.net core2008. 8. 27. 23:55

* 함수의 첨으로 가기

   1: public void BeginningOfFunction()
   2: {
   3:     TextSelection ts = _applicationObject.ActiveDocument.Selection as TextSelection;
   4:  
   5:     ts.MoveToPoint(ts.ActivePoint.get_CodeElement(vsCMElement.vsCMElementFunction)
   6:         .GetStartPoint(vsCMPart.vsCMPartBody), false);
   7:  
   8:     ts.NewLine(1);
   9:     ts.LineUp(false, 1);
  10:     ts.Insert("int i= 100 ; // up", 1);
  11:     ts.SmartFormat();
  12: }

* 함수의 끝으로 가기

   1: public void EndOfFunction()
   2: {
   3:     TextSelection ts = _applicationObject.ActiveDocument.Selection as TextSelection;
   4:  
   5:     ts.MoveToPoint(ts.ActivePoint.get_CodeElement(vsCMElement.vsCMElementFunction)
   6:         .GetEndPoint(vsCMPart.vsCMPartBody), true);
   7:  
   8:     
   9:     ts.Collapse();
  10:     ts.LineUp(false, 1);
  11:     ts.Insert("int b = 100 ; // down", 1);
  12:     ts.SmartFormat();
  13: }

* 함수의 마지막에 함수명 주석 추가하기

   1: TextSelection ts = _applicationObject.ActiveDocument.Selection as TextSelection;
   2:  
   3: CodeElement ce = ts.ActivePoint.get_CodeElement(vsCMElement.vsCMElementFunction);
   4:  
   5: ts.MoveToPoint(ts.ActivePoint.get_CodeElement(vsCMElement.vsCMElementFunction)
   6:     .GetEndPoint(vsCMPart.vsCMPartBody), true);
   7: ts.Collapse();
   8: ts.NewLine(1);
   9: ts.LineUp(false, 1);
  10: ts.Insert("//" + ce.Name, 1);
  11: ts.SmartFormat();
Posted by metalzone