⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 Professional C# 2nd Edition
💻 CS
字号:
using System;
using System.Collections.Specialized;
using System.IO;
namespace Wrox.ProCSharp.Assemblies.Sharing
{
	public class SimpleShared
	{
		private StringCollection quotes;
		private Random random;
		public SimpleShared(string filename)
		{
			quotes = new StringCollection();
			Stream stream = File.OpenRead(filename);
			StreamReader streamReader = new StreamReader(stream);
			string quote;
			while ((quote = streamReader.ReadLine()) != null)
			{
				quotes.Add(quote);
			}
			streamReader.Close();
			stream.Close();
			random = new Random();
		}
		public string GetQuoteOfTheDay()
		{
			int index = random.Next(1, quotes.Count);
			return quotes[index];
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -