考慮下面的代碼:VB.NET中塊級變量的作用域是什麼?
For i As Integer = 0 To 10
Dim str As String = str & " Kratika "
Next
當我附加調試和i = 10
檢查str
的價值,我看到以下內容:
Kratika Kratika Kratika Kratika Kratika Kratika Kratika Kratika Kratika Kratika Kratika
爲什麼串聯以前的值?我期望這個變量每次都被設置爲kratika
,因爲每次它都會聲明一個新的String對象,對吧?
@CodeGray你會請回顧這篇文章http://stackoverflow.com/questions/14937392/object-of-interop-word-document-class-is-null-on-windows-server-2008-word-open – vikas