Avatar of Dinesh Bali
Dinesh Bali
 asked on

Get byte[] from IQueryable<byte[]>

Hi,

I am working on C#, ASP.net application.


I am getting IQueryable<byte[]> from the query.
I need byte[] bytes to pass into the method Read to get the real document.

Please advise the solution


IQueryable<byte[]> AWBFile = from x in repository.Select() where x.OrderCode == ordercode && x.TrackingNumber == trackingNumber select x.AWBimagefile;

byte[] bytes = AWBFile //  Get bytes[] from here
docFromUrl.Read(bytes);

Open in new window


Thanks
ASP.NETC#

Avatar of undefined
Last Comment
Lukasz Zielinski

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Lukasz Zielinski

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dinesh Bali

ASKER
Thanks

You mean I need to proceed as

byte[] bytesArr = AWBFile.ToArray();

foreach(var i in bytesArr)
{
  docFromUrl.Read(i);
}

Open in new window

Lukasz Zielinski

Hi,

I do not know what docFromUrl is and how it's .Read() methods works.
But my guess is that this should be enough:

byte[] bytesArr = AWBFile.ToArray();
docFromUrl.Read(bytes);
Dinesh Bali

ASKER
Many thanks for your help.
Solution worked.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Lukasz Zielinski

glad to be helpful!

ziolko.