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

📄 person.cs

📁 I built the Superlist control whilst developing an RSS reader called FeedGhost. Although there are p
💻 CS
字号:
/////////////////////////////////////////////////////////////////////////////
//
// (c) 2007 BinaryComponents Ltd.  All Rights Reserved.
//
// http://www.binarycomponents.com/
//
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
//
// (c) 2006 BinaryComponents Ltd.  All Rights Reserved.
//
// http://www.binarycomponents.com/
//
/////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace SuperListTest
{
	public class Person: IComparable
	{
		public Person( string surname, string firstname, string phone, string city, string state )
			: this( surname, firstname, phone, city, state, null  )
		{
		}
		private static int _nextId = 1;
		private int _id = _nextId++;
		public Person( string surname, string firstname, string phone, string city, string state, DateTime ?date)
		{
			this.Surname = surname;
			this.Firstname = firstname;
			this.Phone = phone;
			this.City = city;
			this.State = state;

			if( date == null )
			{
				date = DateTime.Now + new TimeSpan( _randomizer.Next(0, 1000 * 60  * 60 * 24 * 7 ) );
			}
			this.Date = date.Value;
		}

		private static Random _randomizer = new Random( 1 );

		public override string ToString()
		{
			return _id + " " + this.Firstname + " " + this.Surname;
		}

		public string Surname;
		public string Firstname;
		public string Phone;
		public string City;
		public string State;
		public DateTime Date;

		private static int _count = 0;
		public static Person[] GetData()
		{
			Person[] persons = new Person[]{
			new Person( "Alexander",	"Lee",	"408 496-7223",	"Menlo Park",	"CA", DateTime.Now  ),
			new Person( "O'Leary",	"Fay",	"408 286-2428",	"San Jose",	"CA", DateTime.Now + new TimeSpan( 0, 1, 0, 0 ) ),
			new Person( "Alexander",	"Sam",	"415 986-7020",	"Oakland",	"CA", DateTime.Now + new TimeSpan( 0, 1, 0, 0 )  ),
			new Person( "O'Leary",	"Jim",	"408 286-2428",	"San Jose",	"CA", DateTime.Now + new TimeSpan( 0, 0, 0, 0 ) ),
			new Person( "Alexander",	"Harry",	"415 548-7723",	"Berkeley",	"CA", DateTime.Now + new TimeSpan( 0, 3, 0, 0 ) ),
			new Person( "O'Leary",	"Jack",	"408 286-2428",	"San Jose",	"CA", DateTime.Now + new TimeSpan( 0, 0, 2, 0 ) ),
			new Person( "Straight",	"Dean",	"415 834-2919",	"Oakland",	"CA", DateTime.Now - new TimeSpan( 3, 0, 0, 0 ) ),
			new Person( "Smith",	"Meander",	"913 843-0462",	"Lawrence",	"KS" ),
			new Person( "Bennet",	"Abraham",	"415 658-9932",	"Berkeley",	"CA" ),
			new Person( "Dull",	"Ann",	"415 836-7128",	"Palo Alto",	"CA" ),
			new Person( "Gringlesby",	"Burt",	"707 938-6445",	"Covelo",	"CA" ),
			new Person( "Locksley",	"Charlene",	"415 585-4620",	"San Francisco",	"CA" ),
			new Person( "Greene",	"Morningstar",	"615 297-2723",	"Nashville",	"TN" ),
			new Person( "Blotchet-Halls",	"Reginald",	"503 745-6402",	"Corvallis",	"OR" ),
			new Person( "Yokomoto",	"Akiko",	"415 935-4228",	"Walnut Creek",	"CA" ),
			new Person( "del Castillo",	"Innes",	"615 996-8275",	"Ann Arbor",	"MI" ),
			new Person( "DeFrance",	"Michel",	"219 547-9982",	"Gary",	"IN" ),
			new Person( "Stringer",	"Dirk",	"415 843-2991",	"Oakland",	"CA" ),
			new Person( "MacFeather",	"Stearns",	"415 354-7128",	"Oakland",	"CA" ),
			new Person( "Karsen",	"Livia",	"415 534-9219",	"Oakland",	"CA" ),
			new Person( "Panteley",	"Sylvia",	"301 946-8853",	"Rockville",	"MD" ),
			new Person( "Hunter",	"Sheryl",	"415 836-7128",	"Palo Alto",	"CA" ),
			new Person( "McBadden",	"Heather",	"707 448-4982",	"Vacaville",	"CA" ),
			new Person( "Ringer",	"Anne",	"801 826-0752",	"Salt Lake City",	"UT" ),
			new Person( "Ringer",	"Albert",	"801 826-0752",	"Salt Lake City",	"UT" ),		
			};
			foreach( Person person in persons )
			{
				_count++;
				person.Firstname = _count.ToString() + " " + person.Firstname;
			}
			return persons;
		}

		#region IComparable Members

		public int CompareTo( object obj )
		{
			Person p = obj as Person;
			if( p == null )
				return -1;
			return this._id - p._id;
		}

		#endregion
	};
}

⌨️ 快捷键说明

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