Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Attachment Class

  Switch on low bandwidth view
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Attachment Constructor

Initializes a new instance of the Attachment class.

  NameDescription
Public methodAttachment(String) Initializes a new instance of the Attachment class with the specified content string.
Public methodAttachment(Stream, ContentType) Initializes a new instance of the Attachment class with the specified stream and content type.
Public methodAttachment(Stream, String) Initializes a new instance of the Attachment class with the specified stream and name.
Public methodAttachment(String, ContentType) Initializes a new instance of the Attachment class with the specified content string and ContentType.
Public methodAttachment(String, String) Initializes a new instance of the Attachment class with the specified content string and MIME type information.
Public methodAttachment(Stream, String, String) Initializes a new instance of the Attachment class with the specified stream, name, and MIME type information.
Top
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Some notes about using Streams      cathexis   |   Edit   |   Show History
First of all, the Stream that you supply to an attachment is not read until you actually send a message. That should make sense enough, but sometimes it's easy to forget. If your stream relies on some other resource that was disposed of by the time the message is sent, the client will fail to send your message.

Secondly, if you are writing into a Stream that will later be read by an Attachment, make sure you set the Position back to 0. Otherwise, you may end up with zero-length attachments even though your stream has data! Attachment does not appear to rewind the Stream for you; it reads from whatever position the Stream is currently at.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker