Class CodeRef
Reference to source code. It contains the path to the file, the method name and the line in the code.
This is used to track the exact location in the code where a log was added/created.
[InternalApi_DoNotUse_MayChangeWithoutNotice("This is just FYI")]
public class CodeRef
- Inheritance
-
CodeRef
Remarks
This is a very internal plumbing-object important for referencing code in log entries.
Constructors
CodeRef(string, string, int)
Reference to source code. It contains the path to the file, the method name and the line in the code.
This is used to track the exact location in the code where a log was added/created.
public CodeRef(string cPath = null, string cName = null, int cLine = 0)
Parameters
cPath
stringauto pre-filled by the compiler - path to the code file
cName
stringauto pre-filled by the compiler - method name
cLine
intauto pre-filled by the compiler - code line number
Remarks
This is a very internal plumbing-object important for referencing code in log entries.
Fields
Line
Line of code where the code was running
public readonly int Line
Field Value
Message
public const string Message = "Message"
Field Value
Name
Name of the method/property accessed
public readonly string Name
Field Value
Path
Path to the code file
public readonly string Path
Field Value
Methods
Create(string, string, int)
Manually create a CodeRef using an already available set of path/name/line. Mainly used for very internal APIs.
public static CodeRef Create(string cPath, string cName, int cLine)
Parameters
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
UseOrCreate(CodeRef, string, string, int)
Special helper to choose from an already existing CodeRef object or to create a new one if it was null.
public static CodeRef UseOrCreate(CodeRef codeRef, string cPath, string cName, int cLine)
Parameters
codeRef
CodeRefExiting CodeRef object or
null
cPath
stringauto pre-filled by the compiler - path to the code file
cName
stringauto pre-filled by the compiler - method name
cLine
intauto pre-filled by the compiler - code line number