本文整理汇总了VB.NET中System.Runtime.CompilerServices.CallerLineNumberAttribute类的典型用法代码示例。如果您正苦于以下问题:VB.NET CallerLineNumberAttribute类的具体用法?VB.NET CallerLineNumberAttribute怎么用?VB.NET CallerLineNumberAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CallerLineNumberAttribute类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: DoProcessing
Private Sub DoProcessing()
TraceMessage("Something happened.")
End Sub
Public Sub TraceMessage(message As String,
<System.Runtime.CompilerServices.CallerMemberName> Optional memberName As String = Nothing,
<System.Runtime.CompilerServices.CallerFilePath> Optional sourcefilePath As String = Nothing,
<System.Runtime.CompilerServices.CallerLineNumber()> Optional sourceLineNumber As Integer = 0)
System.Diagnostics.Trace.WriteLine("message: " & message)
System.Diagnostics.Trace.WriteLine("member name: " & memberName)
System.Diagnostics.Trace.WriteLine("source file path: " & sourcefilePath)
System.Diagnostics.Trace.WriteLine("source line number: " & sourceLineNumber)
End Sub
' Sample output:
' message: Something happened.
' member name: DoProcessing
' source file path: C:\Users\username\Documents\Visual Studio 2012\Projects\CallerInfoVB\CallerInfoVB\Form1.vb
' source line number: 15