Caller Information
Reflection is very powerful and enables you to retrieve every possible bit of information from an assembly and types defined in the assembly, including at runtime. However, you might want to catch some information, typically to log some activities, which would be difficult to retrieve via reflection, at least with an easy approach. The .NET Framework 4.6 makes this easier by offering a set of attributes called caller information. This is the list of new attributes exposed by the System.Runtime.CompilerServices
namespace:
CallerFilePath
returns the name of the file where a specific code block is being executed
CallerLineNumber ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.