base64 编码

总是记不住XmlDocument如何转成XmlReader,很糟糕,还是记下来,省的以后又浪费时间琢磨。

            '转为XmlReader
            Public xmlstring As String
            Dim xd As New Xml.XmlDocument
            xd.LoadXml(xmlstring)
            Dim xmlr As Xml.XmlReader
            xmlr = Xml.XmlReader.Create(New IO.StringReader(xd.OuterXml))
            '转为DataTable
            Dim ds As New Data.DataSet
            ds.ReadXml(xmlr)
            Dim dt As System.Data.DataTable = ds.Tables("item")

总是记不住字符串如何转成BASE64编码,也记下:

        Dim cc As String = "字符串字符串"
        Dim bt() As Byte = System.Text.Encoding.Default.GetBytes(cc)
        Dim b64str As String = Convert.ToBase64String(bt)
        MessageBox.Show(b64str)

 

总是记不住图片如何转成BASE64编码,也记下:
                Dim PhotoBase64 As String
                If Not DocumentObj.TaxTempletDesign.BackgroundImage Is Nothing Then
                    Dim PhotoStream As New IO.MemoryStream
                    DocumentObj.TaxTempletDesign.BackgroundImage.Save(PhotoStream, Imaging.ImageFormat.Jpeg)
                    Dim PhotoByte() As Byte = PhotoStream.ToArray
                    PhotoBase64 = Convert.ToBase64String(PhotoByte)
                Else
                    PhotoBase64 = ""
                End If

 

http://lvzz.zwms.net/article/%E7%A8%8B%E5%BA%8F%E7%A0%94%E5%8F%91/trackback.asp?tbID=112&action=addtb&tbKey=0f14dd626460b6d801b8c83f3d4e388a8f7ee427

你可能感兴趣的:(读书,string,bt,byte,action,c)