您的位置:首页 > 编程语言 > C#

C#键值对集合

2016-04-05 14:53 375 查看
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ArrayList list = new ArrayList();
//ArrayList的一些方法
//Remove RemoveAt RemoveRange Clear Insert InsertRange Reverse Sort

Hashtable ht = new Hashtable();
ht.Add(1, "张三");
ht.Add(true, "男");
//键值对集合中键必须是唯一的,
ht[1] = "sim";

foreach (var item in ht.Keys)
{
Console.WriteLine("{0}----------------{1}", item, ht[item]);
}
// Console.ReadKey();

//Path.GetFileNameWithoutExtension();

byte[] buffer = File.ReadAllBytes(@"C:\Users\yn\Pictures\C#\C#.txt");
string s = Encoding.GetEncoding("UTF-8").GetString(buffer);

Console.WriteLine(s);
Console.ReadKey();

string str = "qweqweqwe";
byte[] buffer1 = Encoding.Default.GetBytes(str);
File.WriteAllBytes(@"C:\1.txt", buffer1);

}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c#