개체

2011-08-11 5 views
2

의 다음 코드를 새 인스턴스를 초기화 할 필요가개체

Dim TestString As String 
나는 그것을 같이 할 수 있도록 할 필요가 무엇 변화

:

Dim TestString As New StringBuilder() 

새로운 키워드를 표시하는 방법에 관심이 있습니다.

답변

4

생성자의 3 인자로 CodeObjectCreateExpression을 추가

CodeVariableDeclarationStatement variableDeclaration = new CodeVariableDeclarationStatement(
    // Type of the variable to declare. 
    typeof(System.Text.StringBuilder), 
    // Name of the variable to declare. 
    "TestString", 
    // A CodeExpression that indicates the initialization expression for the variable. 
    new CodeObjectCreateExpression(typeof(System.Text.StringBuilder), new CodeExpression[] {}) 
); 
관련 문제