using System.Runtime.CompilerServices;

[MethodImpl(MethodImplOptions.Synchronized)]
public static TResult MapTo<TResult>(this object source){
  //操作
}

本文转载:CSDN博客