in libyara.NET/Compiler.h [82:94]
void AddRuleString(String^ rule)
{
compilationErrors->Clear();
auto nativeRule = marshal_as<std::string>(rule);
auto errors = yr_compiler_add_string(
compiler,
nativeRule.c_str(),
nullptr);
if (errors)
throw gcnew CompilationException(compilationErrors);
}