1: '//Penggunaan underscore di VB digunakan untuk memecah
2: '//kode program menjadi beberapa baris
3: '//Pada VB 10 penggunaan underscore ini dihilangkan
4: '//untuk kondisi-kondisi tertentu, fitur ini disebut dengan
5: '//Implicit Line Continuation
6: '//kondisi dimana fitur ini dapat digunakan yaitu :
7:
8: '1. Setelah attribute
9: '2. Setelah koma
10: '3. Setelah titik
11: '4. Setelah binary operator
12: '5. Setelah LINQ query clause
13: '6. Setelah a (, {, or <%=
14: '7. Sebelum a ), }, or %>
15:
16: '//Implicit Line Continuation setelah penggunaan Attribut
17: <System.ComponentModel.Browsable(True)>
18: <System.ComponentModel.Category("Roel's Category")>
19: Public Property GetColor As System.Drawing.Color = Color.Azure
20:
21: '//Implicit Line Continuation setelah penggunaan koma, (, dan )
22: Private Function FuncWithImplicitLineContinuation(
23: ByVal teks As String,
24: ByVal title As String
25: ) As DialogResult
26:
27: Return MessageBox.Show(teks, title, MessageBoxButtons.YesNo,
28: MessageBoxIcon.Question
29: )
30:
31: End Function
32:
33: Private Sub AnotherImplicitLineContinuation()
34:
35: '//Implicit Line Continuation setelah LINQ query clause, {, dan }
36: Dim bilGenap =
37: From num In
38: {
39: 1,
40: 2,
41: 3
42: }
43: Where num Mod 2 = 0
44: Select num
45:
46:
47: '//Implicit Line Continuation setelah <%=, %>, {, dan }
48: Dim bookList As List(Of Book) = New List(Of Book) From
49: {
50: {1, "Visual Basic 10"},
51: {2, "Visual C# 4.0"}
52: }
53:
54:
55: Dim itsEasyToCreateXMLFileUsingXMLLiterals =
56: <Books>
57: <%=
58: From book In bookList
59: Select <Book ISBN=<%=
60: book.ISBN
61: %>>
62: <Title><%=
63: book.Title
64: %></Title>
65: </Book>
66: %>
67: </Books>
68:
69: End Sub