I have a C++ code that I'm trying to migrate to C#. Over there, on C++, i was using the following macros definition for debugging purposes.
#define CODE_LOCATION(FILE_NAME, LINE_NUM, FUNC_NAME) LINE_NUM, FILE_NAME, FUNC_NAME
#define __CODE_LOCATION__ CODE_LOCATION(__FILE__, __LINE__, __FUNCTION__)
Are there similar constructs in C#? I know there are no macros in C#, but is there any other way to get the current file, line and function values during execution?
What A/C Means. The term “A/C” stands for “air conditioning,” but it's frequently used to describe any type of home cooling equipment, such as a traditional split-system air conditioner or heat pump, mini-split unit, geothermal system, or even a window unit.
Senior Member. A/C unit (air conditioning unit) is a single machine. (e.g. What's that ugly box on your wall? - It's the air conditioning unit.) A/C (air conditioning) is the entire system, or the result it gives.
He combined moisture with ventilation to "condition" and change the air in the factories, controlling the humidity so necessary in textile plants. Willis Carrier adopted the term and incorporated it into the name of his company. Domestic air conditioning soon took off.
a/ c is an abbreviation for air-conditioning. Keep your windows up and the a/c on high.
If you are using .net 4.5 you can use CallerMemberName CallerFilePath CallerLineNumber attributes to retrieve this values.
public void DoProcessing()
{
TraceMessage("Something happened.");
}
public void TraceMessage(string message,
[CallerMemberName] string memberName = "",
[CallerFilePath] string sourceFilePath = "",
[CallerLineNumber] int sourceLineNumber = 0)
{
Trace.WriteLine("message: " + message);
Trace.WriteLine("member name: " + memberName);
Trace.WriteLine("source file path: " + sourceFilePath);
Trace.WriteLine("source line number: " + sourceLineNumber);
}
If you are using older framework and visual 2012 you just need to declare them as they are in framework (same namespace) to make them work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With