c# - Converting stream to base 64 -




i working xamarin forms , received image in stream. now, need convert base64 send webservice how can ?

i trying:

protected async task pickimage()     {         try         {             stream stream = await dependencyservice.get<ipicturepicker>().getimagestreamasync();             //stream.gettype<uri>();             if (stream != null)             {                 image image = new image                 {                     source = imagesource.fromstream(() => stream),                     backgroundcolor = color.gray                 };                  cadastrar_foto_perfil.source = imagesource.fromstream(() => stream);                      byte[] imagedata = new byte[stream.length];                     stream.read(imagedata, 0, system.convert.toint32(stream.length));                     string _base64string = convert.tobase64string(imagedata);                      user.cont_imagem = _base64string;             }              if (device.os == targetplatform.ios)             {                 loginpage.recriacadastroios();             }         } 

but @ first line error:

specified method not supported.

thanks help





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -