VS2013 C#函数声明=>符号

Sta*_*iRe 3 c# declaration function visual-studio-2013

这段代码在vs2013中给了我错误...我现在不知道为什么......有人可以帮助我吗?我的问题是我不知道它=>是什么意思以及如何修复错误

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);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Bra*_*NET 6

在这种情况下,=>表示表达式身体成员,相当于:

public static void Fatal(this ILogger l, Func<string> msgFactory) 
{ 
    return FilteredLog(l, LogLevel.Fatal, null, msgFactory); 
}
Run Code Online (Sandbox Code Playgroud)

但是,这种语法是在C#6中引入的,它需要Visual Studio 2015编译器或更新版本.切换到方法语法或升级您的Visual Studio版本.