markus / ConvertService / ServiceBase / Markus.Service.Extensions / Helper / ObjectToBytesStringConvert.cs @ 53c9637d
이력 | 보기 | 이력해설 | 다운로드 (834 Bytes)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
|
7 |
namespace Markus.Service.Helper |
8 |
{ |
9 |
public static class BytesToStringConvert |
10 |
{ |
11 |
|
12 |
/// <summary> |
13 |
/// byte[] to string |
14 |
/// </summary> |
15 |
/// <param name="bytes"></param> |
16 |
/// <returns></returns> |
17 |
public static string Base64BytesToString(byte[] bytes) |
18 |
{ |
19 |
string str = Convert.ToBase64String(bytes); |
20 |
return str; |
21 |
} |
22 |
|
23 |
/// <summary> |
24 |
/// string to byte[] |
25 |
/// </summary> |
26 |
/// <param name="s"></param> |
27 |
/// <returns></returns> |
28 |
public static byte[] StringToBase64Bytes(string s) |
29 |
{ |
30 |
byte[] StrByte = Convert.FromBase64String(s); |
31 |
return StrByte; |
32 |
} |
33 |
|
34 |
} |
35 |
} |