در خصوص AndAlso تنها اینو میدونم که مثلا اگر در یک شرط if اگر قرار باشه مقدار چند چیز با هم مقایسه بشه که آیا با هم برابرند یا نه، اگر شرط اول برقرار نباشه از بررسی مابقی شرط ها صرفنظر میکنه و از بلوک دستور if خارج میشه اما استفاده از AND باعث میشه که برنامه تمام شرط ها را بررسی کنه.
Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Dim adapter As NetworkInterface
Dim myMac As String = String.Empty
For Each adapter In adapters
Response.Write("<BR/>" & adapter.GetPhysicalAddress.ToString())
Next adapter
منبع: stackOverflow
Function createMenu() As String
Dim ds As New DataSet()
Dim cn As New SqlConnection(DB.connectionStirng.ConnectionString())
Dim cmd As New SqlCommand("SELECT * FROM content order by sort asc", cn)
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
Dim table As DataTable = ds.Tables(0)
Dim parentMenus As DataRow() = table.Select("[parent]=1")
Dim sb = New StringBuilder()
Dim unorderedList As String = GenerateUL(parentMenus, table, sb)
Return (unorderedList)
End Function
Private Function GenerateUL(ByVal menu As DataRow(), ByVal table As DataTable, ByVal sb As StringBuilder) As String
sb.AppendLine("<ul>")
If menu.Length > 0 Then
For Each dr As DataRow In menu
Dim menuText As String = dr("title").ToString()
Dim line As String = [String].Format("<li><a href=#>{0}</a>", menuText)
sb.AppendLine(line)
Dim pid As String = dr("id").ToString()
Dim subMenu As DataRow() = table.Select("[parent]=" & pid)
If subMenu.Length > 0 Then
Dim subMenuBuilder = New StringBuilder()
sb.AppendLine(GenerateUL(subMenu, table, subMenuBuilder))
End If
sb.AppendLine("</li>")
Next
End If
sb.Append("</ul>")
Return sb.ToString()
End Function