كود :
Private Function GetStreamAsByteArray(ByVal stream As System.IO.Stream) As Byte()
Dim streamLength As Integer = Convert.ToInt32(stream.Length)
Dim fileData As Byte() = New Byte(streamLength) {}
' Read the file into a byte array
stream.Read(fileData, 0, streamLength)
stream.Close()
Return fileData
End Function
او كيف اقرا البايت الخاص بناتج هذا الكود
كود :
Private Function gficon(ByVal fn As FileInfo) As Bitmap
Return Drawing.Icon.ExtractAssociatedIcon(fn.FullName).ToBitmap()
End Function