Portable class library equivalent to MethodBase.GetCurrentMethod

s there Portable Class Library equivalent to MethodBase.GetCurrentMethod?

I am new to PCL. I'm just looking to see if I can use PCL to store some client code that will definitely be used in Silverlight and can be used elsewhere. Having scanned the source, I see many calls to the MethodBase.GetCurrentMethod method, which does not seem to exist in the PCL.

** EDIT **

I tore this sample from the library. IsNullOrEmpty () uses String.IsNullOrWhiteSpace (String), which does not seem to be available, so a bit of fiction.

using System; using System.Linq; using System.Reflection; using System.Linq.Expressions; namespace LinqToLdap.PCL { public static class QueryableExtensions { internal static bool IsNullOrEmpty(this String str) { return string.IsNullOrEmpty(str); } public static IQueryable<TSource> FilterWith<TSource>(this IQueryable<TSource> source, string filter) { if (source == null) throw new ArgumentNullException("source"); if (filter.IsNullOrEmpty()) throw new Exception("Filters cannot be null, empty, or white-space."); if (!filter.StartsWith("(")) { filter = "(" + filter + ")"; } return source.Provider.CreateQuery<TSource>( Expression.Call( null, ((MethodInfo)MethodBase.GetCurrentMethod()) .MakeGenericMethod(new[] { typeof(TSource) }), new[] { source.Expression, Expression.Constant(filter) } ) ); } } } 
+6
source share
1 answer

(I 'own' the Microsoft Portable Library project)

We do not show it in PCL because it is not supported in Windows 8.NET applications for Metro. What is your use of this method?

+1
source

Source: https://habr.com/ru/post/904607/


All Articles