IMessageFormatter.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //------------------------------------------------------------------------------
  2. // <copyright file="IMessageFormatter.cs" company="Microsoft">
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. // </copyright>
  5. //------------------------------------------------------------------------------
  6. using System;
  7. using System.ComponentModel;
  8. namespace Experimental.System.Messaging
  9. {
  10. /// <include file='doc\IMessageFormatter.uex' path='docs/doc[@for="IMessageFormatter"]/*' />
  11. /// <devdoc>
  12. /// The functions defined in this interface are used to
  13. /// serailize and deserialize objects into and from
  14. /// MessageQueue messages.
  15. /// </devdoc>
  16. [TypeConverterAttribute(typeof(System.Messaging.Design.MessageFormatterConverter))]
  17. public interface IMessageFormatter : ICloneable
  18. {
  19. /// <include file='doc\IMessageFormatter.uex' path='docs/doc[@for="IMessageFormatter.CanRead"]/*' />
  20. /// <devdoc>
  21. /// When this method is called, the formatter will attempt to determine
  22. /// if the contents of the message are something the formatter can deal with.
  23. /// </devdoc>
  24. bool CanRead(Message message);
  25. /// <include file='doc\IMessageFormatter.uex' path='docs/doc[@for="IMessageFormatter.Read"]/*' />
  26. /// <devdoc>
  27. /// This method is used to read the contents from the given message
  28. /// and create an object.
  29. /// </devdoc>
  30. object Read(Message message);
  31. /// <include file='doc\IMessageFormatter.uex' path='docs/doc[@for="IMessageFormatter.Write"]/*' />
  32. /// <devdoc>
  33. /// This method is used to write the given object into the given message.
  34. /// If the formatter cannot understand the given object, an exception is thrown.
  35. /// </devdoc>
  36. void Write(Message message, object obj);
  37. }
  38. }