這個循環(huán)結構的語法是:
With object [ statements ] End With
Module loops Public Class Book Public Property Name As String Public Property Author As String Public Property Subject As String End Class Sub Main() Dim aBook As New Book With aBook .Name = "VB.Net Programming" .Author = "Zara Ali" .Subject = "Information Technology" End With With aBook Console.WriteLine(.Name) Console.WriteLine(.Author) Console.WriteLine(.Subject) End With Console.ReadLine() End Sub End Module
當上述代碼被編譯和執(zhí)行時,它產(chǎn)生以下結果:
VB.Net Programming Zara Ali Information Technology
更多建議: