資源簡介
c# 序列化和反序列化基礎示例。
將序列化和反序列化封裝成 泛型方法 方便調用,提供多種方式,在文件Serializer.cs文件
用于網絡數據傳輸、數據交換等很方便。
生成的文件在程序所在文件夾內。
加密在DES.cs文件
在“引用”添加 System.Runtime.Serialization
代碼添加:
using System.Runtime.Serialization;
將序列化和反序列化封裝成 泛型方法 方便調用,提供多種方式,在文件Serializer.cs文件
用于網絡數據傳輸、數據交換等很方便。
生成的文件在程序所在文件夾內。
加密在DES.cs文件
在“引用”添加 System.Runtime.Serialization
代碼添加:
using System.Runtime.Serialization;
更多學習示例點擊 用戶名
代碼片段和文件信息
using?System;
using?System.IO;
using?System.Security.Cryptography;
using?System.Text;
public?class?DES
{
????//key?is?8?bit
????public?static?string?Encode(string?str?string?key)
????{
????????try
????????{
????????????DESCryptoServiceProvider?provider?=?new?DESCryptoServiceProvider();
????????????provider.Key?=?Encoding.ASCII.GetBytes(key.Substring(0?8));
????????????provider.IV?=?Encoding.ASCII.GetBytes(key.Substring(0?8));
????????????byte[]?bytes?=?Encoding.GetEncoding(“GB2312“).GetBytes(str);
????????????MemoryStream?stream?=?new?MemoryStream();
????????????CryptoStream?stream2?=?new?CryptoStream(stream?provider.CreateEncryptor()?CryptoStreamMode.Write);
????????????stream2.Write(bytes?0?bytes.Length);
????????????stream2.FlushFinalBlock();
????????????Stri
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????47616??2018-03-15?11:47??demo\.vs\demo\v15\.suo
?????文件??????????0??2018-03-15?08:03??demo\.vs\demo\v15\Server\sqlite3\db.lock
?????文件?????610304??2018-03-15?11:47??demo\.vs\demo\v15\Server\sqlite3\storage.ide
?????文件????????189??2018-03-15?08:03??demo\demo\App.config
?????文件??????16896??2018-03-15?11:47??demo\demo\bin\Debug\demo.exe
?????文件????????189??2018-03-15?08:03??demo\demo\bin\Debug\demo.exe.config
?????文件??????34304??2018-03-15?11:47??demo\demo\bin\Debug\demo.pdb
?????文件??????????0??2018-03-15?09:13??demo\demo\bin\Debugdemo2.xm
?????文件???????3688??2018-03-15?08:21??demo\demo\demo.csproj
?????文件???????2125??2018-03-15?11:36??demo\demo\DES.cs
?????文件???????8063??2018-03-15?11:46??demo\demo\Form1.cs
?????文件???????6826??2018-03-15?10:25??demo\demo\Form1.Designer.cs
?????文件???????5817??2018-03-15?10:25??demo\demo\Form1.resx
?????文件????????516??2018-03-15?08:03??demo\demo\Program.cs
?????文件???????1306??2018-03-15?08:03??demo\demo\Properties\AssemblyInfo.cs
?????文件???????2821??2018-03-15?08:03??demo\demo\Properties\Resources.Designer.cs
?????文件???????5612??2018-03-15?08:03??demo\demo\Properties\Resources.resx
?????文件???????1091??2018-03-15?08:03??demo\demo\Properties\Settings.Designer.cs
?????文件????????249??2018-03-15?08:03??demo\demo\Properties\Settings.settings
?????文件???????4466??2018-03-15?11:38??demo\demo\Serializer.cs
?????文件???????1111??2018-03-15?08:03??demo\demo.sln
?????目錄??????????0??2018-03-15?11:47??demo\.vs\demo\v15\Server\sqlite3
?????目錄??????????0??2018-03-15?08:03??demo\.vs\demo\v15\Server
?????目錄??????????0??2018-03-15?08:03??demo\.vs\demo\v15
?????目錄??????????0??2018-03-15?11:47??demo\demo\bin\Debug
?????目錄??????????0??2018-03-15?11:47??demo\demo\obj\Debug
?????目錄??????????0??2018-03-15?08:03??demo\.vs\demo
?????目錄??????????0??2018-03-15?09:13??demo\demo\bin
?????目錄??????????0??2018-03-15?08:03??demo\demo\obj
?????目錄??????????0??2018-03-15?08:03??demo\demo\Properties
............此處省略6個文件信息
- 上一篇:OPC 服務器 操作
- 下一篇:C# 操作防火墻(ipseccmd)
評論
共有 條評論
相關資源
- C#聯通網絡寬帶測試 撥號
- C#百度指數抓取方法(2012年版本已失
- C# 隱藏某個磁盤分區
- wince引腳控制程序
- C# 讀取并編輯window系統的右鍵菜單
- C#自定義屏保(不斷滾動的文字)
- C#winform打印指定區域 -控件拖動 -設置
- C#使用Hook進行改鍵
- 提供C#調用系統API函數彈出或收起光驅
- 通過C#自帶的頭文件(類)獲取Windo
- C#獲取電腦CPU以及內存使用率
- Syndication實現讀取、創建、訂閱、更新
- 利用uu云打碼平臺的lib實現的c#打碼平
- tf-idf一種計算方法
- C# pop3 郵件接收程序
- C# 郵件群發示例 源碼下載18952
- httpclient source code by csharp
- 動態抓取IPC#實現
- NServiceKit.Redis 基礎操作
- XXTEA算法的C#實現和JS實現,可以互相
- C# 飛行棋 游戲源碼(面向對象入門)
- Socke傳輸 (wince6.0系統)
- UDP Messenger 1.0.unitypackage
- asp.net 網頁靜態化組件(shipingx-Stati
- SocketAsyncEventArgs完成斷開編程
- 基于WinPcap的C# ARP欺騙軟件().rar
- C#網絡應用編程 矩陣并行計算練習
- 猜數小游戲WCF網絡編程技術(附服務
- 《C#版Ftp軟件源碼》
- 基于com串口的文件發送和接收