See our CloneDR tool for finding exact and near-space blocks of duplicated code in large bodies of source code.
CloneDR works by analyzing the source code using the compiler's external interface, building compiler data structures ("AST") that represent code and map trees. This means that it can find duplicates, despite layouts, line breaks or comments. The matching process can find code blocks that are similar in the sense that can be parameterized; it easily finds similar blocks with renamed variables or with statements or code blocks that have been replaced.
There are versions for many languages, including C #. An example C # clone detection report can be found on the website.
CloneDR is not a "development preview". I wrote one of the original articles on how to do this in 1998, and has been developing CloneDR since then; see Detecting Clones Using Abstract Syntax Trees . (The Microsoft Clone detector detects clones based on tokens rather than tree-based ones, and produces IMHO responses that are not so good, in fact, such detectors like tokens - thatβs why I wrote the article).
source share