Cache, callback and nested class  :)using System;
Cache, callback and nested class  :)
using System.IO;
Cache, callback and nested class  :)
using System.Xml;
Cache, callback and nested class  :)
using System.Xml.Schema;
Cache, callback and nested class  :)
Cache, callback and nested class  :)
namespace xxx.WebService

One instance of this class will be pushed into cache and everyone can access it. It means that field validateResult is just like a static field. Suppose that A just call Validate() and validateResult is false. After that, B call this method again with a valid xml string, what B get now?  False

 Add a nest class:

Cache, callback and nested class  :)class ValidateCallback
    }

Remove validateResult and add:

Cache, callback and nested class  :)//Set the validation event handler
Cache, callback and nested class  :)
                ValidateCallback callback = new ValidateCallback();
Cache, callback and nested class  :)                vReader.ValidationEventHandler 
+= new ValidationEventHandler(callback.ValidationCallBack);
Cache, callback and nested class  :)                
//Read and validate the XML data.
Cache, callback and nested class  :)
                while (vReader.Read() && callback.ValidateResult);

Everyone can get his own result.

 

相关文章:

  • 2021-07-06
  • 2022-12-23
  • 2021-11-30
  • 2021-10-26
  • 2022-01-26
  • 2021-11-28
猜你喜欢
  • 2022-12-23
  • 2021-09-19
  • 2021-10-17
  • 2022-12-23
  • 2021-05-31
  • 2021-08-08
  • 2021-12-08
相关资源
相似解决方案