public NativeMethods.WError[] GetErrors()
{
CheckContextInitialized();
int number;
// object can be inserted only when the context is stopped
if(_status != ContextStatus.Stopped) {
throw new Exception("Object can be inserted only when the context is stopped");
}
if(GetErrorNumber(out number) == false) {
return null;
}
// get the errors
List<NativeMethods.WError> errors = new List<NativeMethods.WError>();
for(int i = 0; i < number; i++) {
NativeMethods.WError error = new NativeMethods.WError();
if(GetError(i, out error) == false) {
// return what we could get so far
return errors.ToArray();
}
else {
errors.Add(error);
}
}
// all errors could be retrieved
return errors.ToArray();
}