DotNetAnalyzers / ReflectionAnalyzers

Analyzers checking System.Reflection
MIT License
80 stars 8 forks source link

REFL014 message is hard to read #227

Open jnm2 opened 4 years ago

jnm2 commented 4 years ago

These messages obscure the interesting part, GetMethod:

Prefer typeof(EvaluatorContextDescriptor).GetProperty(nameof(EvaluatorContextDescriptor.IsTopLevelCollectionSource), BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, typeof(bool), Type.EmptyTypes, null).GetMethod.

Prefer typeof(IEnumerator).GetProperty(nameof(IEnumerator.Current), BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, typeof(object), Type.EmptyTypes, null).GetMethod.

JohanLarsson commented 4 years ago

How should we change it? Prefer GetProperty(...).GetMethod?

jnm2 commented 4 years ago

That looks good to me! No parens for GetMethod though because it's a property.