Conversion of File to ByteArray

Conversion of File to ByteArray

amitnkukanur
Collaborator Collaborator
1,721 Views
2 Replies
Message 1 of 3

Conversion of File to ByteArray

amitnkukanur
Collaborator
Collaborator

Hello,

I know this is a silly question, but i am stuck up with conversion of file to ByteArray. Can some body please suggest me how to convert a file to ByteArray. 

 

My Problem is i have to add a file to Vault 2013 using C#. If a solution link is provided that would be help full

 

 

Rgds

Amit

Senior Software Engineer
0 Likes
Accepted solutions (1)
1,722 Views
2 Replies
Replies (2)
Message 2 of 3

Redmond.D
Autodesk
Autodesk
Accepted solution

You are not the first to get confused between byte[] and ByteArray.  The VaultFileBrowser sample in the SDK has an example.

 

The basic steps are:

  1. Read in the local file as a byte[].  You can do this using a System.IO.FileStream or calling System.IO.File.ReadAllBytes.
  2. Create a new ByteArray object and set the 3 properties.  For simplicity, I suggest not using compression.
  3. Pass in the ByteArray object to the Add or CheckIn function.

 

 

 



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 3 of 3

amitnkukanur
Collaborator
Collaborator

Perfect, thanks for solution. It worked.

Senior Software Engineer
0 Likes