首页 > 解决方案 > 在 Visual Studio 中查看派生类的扩展方法调用?

问题描述

我在 oPersistentObject 上有一个扩展方法,它是许多不同对象的基类。

现在我想查看调用该方法的位置,但仅适用于 MaintenanceGroups(或任何其他派生类)。

我看不到任何简单的方法可以做到这一点。

原始方法签名:

public static void PersistThrowOnFailure( oPersistentObject persistent, ErrorDetector ed = null )

我想通的唯一方法:

  public static void PersistThrowOnFailure( this ObjectPartGroup persistent, ErrorDetector ed = null ) => GenericPersistThrowOnFailure( persistent, ed );
  public static void PersistThrowOnFailure( this Site persistent, ErrorDetector ed = null ) => GenericPersistThrowOnFailure( persistent, ed );
  public static void PersistThrowOnFailure( this InteroperabilityAssetSettings persistent, ErrorDetector ed = null ) => GenericPersistThrowOnFailure( persistent, ed );

  public static void GenericPersistThrowOnFailure( oPersistentObject persistent, ErrorDetector ed = null )

这可行,但很乏味。但是很高兴我可以看到每个派生类型调用该方法的次数。

有任何想法吗?

在此处输入图像描述

标签: c#visual-studiovisual-studio-2019

解决方案


推荐阅读