This code gives me error in vs2013 ...
I don't now why ... somebody can help me ?!
my problem is i don't know what the => is meant for and how to fix the errors
using System;
namespace SmartStore.Core.Logging
{
public static class LoggingExtensions
{
public static bool IsDebugEnabled(this ILogger l) => l.IsEnabledFor(LogLevel.Debug);
public static void Fatal(this ILogger l, string msg) => FilteredLog(l, LogLevel.Fatal, null, msg, null);
public static void Fatal(this ILogger l, Func<string> msgFactory) => FilteredLog(l, LogLevel.Fatal, null, msgFactory);
public static void ErrorsAll(this ILogger logger, Exception exception)
{
while (exception != null)
{
FilteredLog(logger, LogLevel.Error, exception, exception.Message, null);
exception = exception.InnerException;
}
}
private static void FilteredLog(ILogger logger, LogLevel level, Exception exception, string message, object[] objects)
{
if (logger.IsEnabledFor(level))
{
logger.Log(level, exception, message, objects);
}
}
private static void FilteredLog(ILogger logger, LogLevel level, Exception exception, Func<string> messageFactory)
{
if (logger.IsEnabledFor(level))
{
logger.Log(level, exception, messageFactory(), null);
}
}
}
In this case, the => is denoting an expression-bodied member and is equivalent to:
public static void Fatal(this ILogger l, Func<string> msgFactory)
{
return FilteredLog(l, LogLevel.Fatal, null, msgFactory);
}
However, this syntax was introduced in C# 6 which requires the Visual Studio 2015 compiler or newer. Switch to the method syntax or upgrade your version of visual studio.
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