The HasReference
method checks if a specific reference is present in the compiler's current context. It can perform a shallow or deep search based on the deep
parameter.
The HasReference
method checks if a specific reference is present in the compiler's current context. It can perform a shallow or deep search based on the deep
parameter.
To use the HasReference
method, provide the name of the reference you want to check as a string. Set the deep
parameter to true
if you want to perform a deep search, which checks all dependencies recursively. Set it to false
for a shallow search, which only checks direct references.
// Example usage of HasReference method Sandbox.Compiler compiler = new Sandbox.Compiler(); string referenceName = "System.Linq"; bool deepSearch = true; bool hasReference = compiler.HasReference(referenceName, deepSearch); if (hasReference) { // The reference is present } else { // The reference is not present }