C#将C#6.0转换为C#4.0

时间:2016-02-15 09:10:00

标签: c# .net

如何将此C#6.0代码转换为C#4.0?

public void Subscribe(string message, Action<IMessagingService> callback) =>
            MessagingCenter.Subscribe<MessagingService>(this, message, callback);

public object ConvertBack(object value, Type targetType, object parameter, 
                          CultureInfo culture) => null;

我可以简单地创建get属性吗?

1 个答案:

答案 0 :(得分:5)

你所展示的这种表达方式只是C#6的简写:

public void Subscribe(string message, Action<IMessagingService> callback)
{
    MessagingCenter.Subscribe<MessagingService>(this, message, callback);
}