2016-10-20 21 views
1

方法訪問(Leaf v)Visit(Composite v)被標記爲未被SonarLint使用。還有SonarQube將其標記爲未使用。但它與動態調用。 有誰知道如何解決它?可能有一些配置? 入口點是一個訪問(基礎根),然後使用動態調用它將遍歷樹。規則S1144「刪除未使用的私人方法」c# - VS 2015

UPD:更新例如

這是樣品:

public void Visit(Base root) 
{ 
    Visit((dynamic)root); 
} 

private void Visit(Composite v) 
{ 
    v.Children.ForEach(el => Visit((dynamic)el)); 
} 

private void Visit(Leaf v) 
{ 
    // do smth 
} 

class Base 
{ 
} 

class Composite : Base 
{ 
    public IEnumerable<Base> Children { get;} 
} 

class Leaf : Base 
{ 

} 
+0

你能告訴我們你調用'Visit'的代碼嗎? – dotctor

+0

@dotctor是的,srry入口點是錯誤的,更新後的代碼。這是輕的樣品。 但訪問也在v.Children.ForEach中引用(el => Visit((dynamic)el)); – Alex

+0

@mybirthname刪除聲納 - 這不是一種情況或解決方案 – Alex

回答