VB.Net Tutorial/Attributes/Conditional Attribute

Материал из VB Эксперт
Версия от 15:53, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Conditional Attribute

<source lang="vbnet">Imports System Imports System.Diagnostics

  1. Const DEBUG_LIST_CUSTOMERS = True

"#Const DEBUG_LIST_EMPLOYEES = True public class Test

  public Shared Sub Main
       ListCustomers()
       ListEmployees()
  End Sub
   <Conditional("DEBUG_LIST_CUSTOMERS")> _
   Private Shared Sub ListCustomers()
       Console.WriteLine("ListCustomers")
   End Sub
   <Conditional("DEBUG_LIST_EMPLOYEES")> _
   Private Shared Sub ListEmployees()
       Console.WriteLine("ListEmployees")
   End Sub

End class</source>

ListCustomers