本文整理汇总了C#中Library.List类的典型用法代码示例。如果您正苦于以下问题:C# List类的具体用法?C# List怎么用?C# List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
List类属于Library命名空间,在下文中一共展示了List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Setup
public Setup()
{
LoadPlugins();
AllTitlesProcessed = false;
CurrentTitle = null;
CurrentTitleIndex = 0;
current = this;
//_titleCollection.loadTitleCollection();
_ImporterSelection = new Choice();
List<string> _Importers = new List<string>();
foreach (OMLPlugin _plugin in availablePlugins) {
OMLApplication.DebugLine("[Setup] Adding " + _plugin.Name + " to the list of Importers");
_Importers.Add(_plugin.Description);
}
_ImporterSelection.Options = _Importers;
_ImporterSelection.ChosenChanged += delegate(object sender, EventArgs e)
{
OMLApplication.ExecuteSafe(delegate
{
Choice c = (Choice)sender;
ImporterDescription = @"Notice: " + GetPlugin().SetupDescription();
OMLApplication.DebugLine("Item Chosed: " + c.Options[c.ChosenIndex]);
});
};
}
开发者ID:peeboo,项目名称:open-media-library,代码行数:26,代码来源:Setup.cs
示例2: GetAll
public static List<Copy> GetAll()
{
List<Copy> allcopies = new List<Copy>{};
SqlConnection conn = DB.Connection();
conn.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM copies;", conn);
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
int copyId = rdr.GetInt32(0);
int copyBookId = rdr.GetInt32(1);
Copy newCopy = new Copy(copyBookId, copyId);
allcopies.Add(newCopy);
}
if (rdr != null)
{
rdr.Close();
}
if (conn != null)
{
conn.Close();
}
return allcopies;
}
开发者ID:Rick1970,项目名称:library,代码行数:28,代码来源:Copy.cs
示例3: AddBytes
public static void AddBytes(List<byte> list, byte[] array)
{
foreach (byte b in array)
{
list.Add(b);
}
}
开发者ID:neuroradiology,项目名称:Sxz,代码行数:7,代码来源:Writer.cs
示例4: GetAll
public static List<Patron> GetAll()
{
List<Patron> allPatrons = new List<Patron> {};
SqlConnection conn = DB.Connection();
conn.Open();
SqlDataReader rdr = null;
SqlCommand cmd = new SqlCommand ("SELECT * FROM patrons;", conn);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
int patronId = rdr.GetInt32(0);
string patronFirstName = rdr.GetString(1);
string patronLastName = rdr.GetString(2);
string phoneNumber = rdr.GetString(3);
Patron newPatron = new Patron (patronFirstName, patronLastName, phoneNumber, patronId);
allPatrons.Add(newPatron);
}
if (rdr != null)
{
rdr.Close();
}
if (conn != null)
{
conn.Close();
}
return allPatrons;
}
开发者ID:CrucialGier,项目名称:Library-Database,代码行数:31,代码来源:Patron.cs
示例5: GetBooks
public static List<Book> GetBooks(bool useDB)
{
try
{
DataTable table;
List<Book> books = new List<Book>();
if (useDB)
{
table = DBLibrary.GetBooks(cs);
}
else
{
table = DBLibrary.GetTestData();
}
Book book;
foreach (DataRow row in table.Rows)
{
book = new Book((int)row[0]);
book.Name = row["name"].ToString();
book.Author = row["author"].ToString();
book.Country = row["country"].ToString();
book.Year = (int)row["year"];
books.Add(book);
}
return books;
}
catch (Exception)
{
throw;
}
}
开发者ID:Crowmoore,项目名称:IIO11300,代码行数:32,代码来源:Book.cs
示例6: GetAll
public static List<Copy> GetAll()
{
List<Copy> allCopies = new List<Copy> {};
SqlConnection conn = DB.Connection();
conn.Open();
SqlDataReader rdr = null;
SqlCommand cmd = new SqlCommand ("SELECT * FROM copies;", conn);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
int copyId = rdr.GetInt32(0);
DateTime copyCheckoutDate = rdr.GetDateTime(1);
string copyCondition = rdr.GetString(2);
int bookId = rdr.GetInt32(3);
DateTime copyDueDate = rdr.GetDateTime(4);
Copy newCopy = new Copy (copyCondition, bookId, copyCheckoutDate, copyDueDate, copyId);
allCopies.Add(newCopy);
}
if (rdr != null)
{
rdr.Close();
}
if (conn != null)
{
conn.Close();
}
return allCopies;
}
开发者ID:CrucialGier,项目名称:Library-Database,代码行数:32,代码来源:Copy.cs
示例7: ConvertBoolsToBytes
public static List<byte> ConvertBoolsToBytes(bool[] data)
{
List<byte> result = new List<byte>();
//wrap into 8 bit bunches of a byte
byte eightBits = 0;
int counter = 0;
foreach (bool b in data)
{
//write to next location on eightBits
if (b)
{
eightBits |= Writer.Masks[counter];
}
counter++;
if (counter > 7)
{
counter = 0;
result.Add(eightBits);
eightBits = 0;
}
}
if (counter > 0)
{
//pad out the eightBits with zeros then add
result.Add(eightBits);
}
return result;
}
开发者ID:jubalh,项目名称:Sxz,代码行数:34,代码来源:BitPlane.cs
示例8: DownloadAllVideos
public void DownloadAllVideos(PDownload pDownload)
{
Broadcasts broadcasts = GetBroadcasts(pDownload.User);
broadcasts.broadcasts = broadcasts.broadcasts.Where(b => b.available_for_replay || b.state == "RUNNING").ToList();
if (pDownload.IsReverseOrder) broadcasts.broadcasts.Reverse();
#region Selected Videos
List<int> selectedVideos = pDownload.SelectedVideos;
if (selectedVideos.Any())
{
List<Broadcast> selectedBroadcasts = new List<Broadcast>();
selectedBroadcasts.AddRange(selectedVideos.Select(selectedVideo => broadcasts.broadcasts[selectedVideo]));
broadcasts.broadcasts = selectedBroadcasts.ToList();
}
#endregion
#region Selected Broadcasts
List<string> selectedBroadcastsText = pDownload.SelectedBroadcasts;
if (selectedBroadcastsText.Any())
{
broadcasts.broadcasts =
selectedBroadcastsText.Select(
selectedBroadcast => broadcasts.broadcasts.First(b => b.id == selectedBroadcast)).ToList();
}
#endregion
Console.WriteLine(broadcasts.broadcasts.Count + " broadcasts found.");
foreach (var broadcast in broadcasts.broadcasts)
{
DownloadVideos(broadcast, pDownload.DownloadLiveStream);
}
}
开发者ID:suphero,项目名称:PDownloader,代码行数:32,代码来源:VideoDownloader.cs
示例9: LoadData
private void LoadData(DTO.HoaDon data)
{
listHoaDonDetail = HoaDonDetailBus.GetListByIdHoaDon(data.Id);
dataUser = data.User;
lbMaHD.Text = data.MaHoaDon;
lbNguoiNhap.Text = dataUser == null ? string.Empty : dataUser.UserName;
lbNgayGio.Text = data.CreateDate.ToString(Constant.DEFAULT_DATE_TIME_FORMAT);
lbGhiChu.Text = data.GhiChu;
foreach (DTO.HoaDonDetail detail in listHoaDonDetail)
{
ListViewItem lvi = new ListViewItem();
lvi.SubItems.Add(detail.SanPham.Id.ToString());
lvi.SubItems.Add((lvThongTin.Items.Count + 1).ToString());
lvi.SubItems.Add(detail.SanPham.MaSanPham + Constant.SYMBOL_LINK_STRING + detail.SanPham.Ten);
lvi.SubItems.Add(detail.SoLuong.ToString());
lvi.SubItems.Add(detail.SanPham.DonViTinh);
lvi.SubItems.Add(detail.SanPham.GiaMua.ToString(Constant.DEFAULT_FORMAT_MONEY));
lvi.SubItems.Add(detail.SanPham.GiaBan.ToString(Constant.DEFAULT_FORMAT_MONEY));
lvi.SubItems.Add(detail.ThanhTien.ToString(Constant.DEFAULT_FORMAT_MONEY));
lvThongTin.Items.Add(lvi);
}
lbTongHD.Text = data.ThanhTien.ToString(Constant.DEFAULT_FORMAT_MONEY);
}
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:28,代码来源:UcDetail.cs
示例10: btnBrowse_Click
private void btnBrowse_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
btnUpload.Enabled = true;
lblError.Text = "";
#region dataGridView stuff
List<String> files = openFileDialog1.SafeFileNames.ToList();
List<Library.File> myFiles = new List<Library.File>();
foreach (string f in files)
{
Library.File file = new Library.File(f, "", Project);
myFiles.Add(file);
}
dataGridView1.DataSource = myFiles;
dataGridView1.Columns.Remove("id");
dataGridView1.Columns.Remove("VersionNr");
dataGridView1.Columns.Remove("FileLock");
dataGridView1.Columns.Remove("FileLockTime");
dataGridView1.Columns.Remove("Project");
dataGridView1.AutoResizeColumns();
#endregion
foreach (string filepath in openFileDialog1.FileNames)
{
fullFilePathList.Add(filepath);
fileToUploadList.Add(Path.GetFileName(filepath));
}
}
}
开发者ID:dmab0914-Gruppe-2,项目名称:3-Semester-Project-Share,代码行数:29,代码来源:MultiUpload.cs
示例11: buttonReserve_Click
private void buttonReserve_Click(object sender, EventArgs e)
{
LibraryReader.LibraryEntities context = new LibraryReader.LibraryEntities();
List<int> books = new List<int>();
foreach (DataGridViewRow row in dataGridViewBooks.SelectedRows)
{
if (row.Cells[0].Value != null)
{
books.Add(Convert.ToInt32(row.Cells[0].Value));
}
}
if (books.Count > 0)
{
var client = (from c in context.Clients
where c.ClientID == id
select c).SingleOrDefault();
foreach (LibraryReader.ClientsBook cBook in client.ClientsBooks)
{
if (books.Contains(cBook.BookID))
{
cBook.Reservation = true;
MessageBox.Show("Резервирането е успешно!");
}
}
context.SaveChanges();
}
}
开发者ID:nikup,项目名称:Library-IT-Olympiad,代码行数:33,代码来源:FormSearch.cs
示例12: BackEnd
public BackEnd(string data)
{
words = new List<string>(data.Split(' ', '\r'));
content = new List<string>(data.Split(' ', '\r', '\n'));
frequency = BuildOccu(content);
length = BuildLeng(content);
}
开发者ID:kevinzhang2012,项目名称:C-Sharp-Programs,代码行数:7,代码来源:BackEnd.cs
示例13: ReadLine
public override string ReadLine()
{
if (stream.Position == stream.Length)
{
return null;
}
var byteList = new List<int>();
while (stream.Position != stream.Length)
{
int b = stream.ReadByte();
if (b == (int)'\n')
{
break;
}
else
{
byteList.Add(b);
}
}
while (byteList[byteList.Count - 1] == (int)'\r')
{
byteList.RemoveAt(byteList.Count - 1);
}
return Encoding.UTF8.GetString(byteList.Select(value => (byte)value).ToArray());
}
开发者ID:KalitaAlexey,项目名称:axxon_soft_test_task,代码行数:26,代码来源:UnbufferedStreamReader.cs
示例14: Install
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
var installdir = GetParameter("targetdir");
string msg = "";
foreach (var k in Context.Parameters.Keys)
msg += (k + "\n");
msg += "VALUES:\n";
foreach (var v in Context.Parameters.Values)
msg += (v + "\n");
//MessageBox.Show(msg);
List<string> writeableDirs = new List<string>();
string configDir = Path.Combine(Path.Combine(installdir, "Myro"), "config");
string storeDir = Path.Combine(Path.Combine(installdir, "Myro"), "store");
writeableDirs.Add(configDir);
writeableDirs.Add(storeDir);
writeableDirs.AddRange(Directory.GetDirectories(configDir, "*", SearchOption.AllDirectories));
writeableDirs.AddRange(Directory.GetDirectories(storeDir, "*", SearchOption.AllDirectories));
string dirs = "";
foreach (var d in writeableDirs)
{
dirs += (d + "\n");
if (GrantModifyAccessToFolder("Everyone", d) != true)
throw new Exception("Couldn't make " + d + " writeable");
}
//MessageBox.Show("Made writeable:\n" + dirs);
}
开发者ID:roboshepherd,项目名称:myro-epuck,代码行数:34,代码来源:Installer1.cs
示例15: GetPortInfo
public List<PortInfo> GetPortInfo()
{
List<PortInfo> portInfo = new List<PortInfo>();
string ip = Convert.ToString(Net.GetExternalIpAddress(30000));
foreach (INetFwOpenPort port in GetAuthOpenPortsList())
{
portInfo.Add(new PortInfo()
{
IP = ip,
Port = port.Port,
Name = port.Name
});
//sb.AppendLine(ip + ":" + port.Port + " - " + port.Name + " - " + port.Enabled + " - " + port.IpVersion);
Console.WriteLine(port.Port + ", " + port.Name);
}
/*StringBuilder sb = new StringBuilder();
foreach (INetFwOpenPort port in GetAuthOpenPortsList())
{
sb.AppendLine(ip + ":" + port.Port + " - " + port.Name + " - " + port.Enabled + " - " + port.IpVersion);
Console.WriteLine(port.Port + ", " + port.Name);
}
System.Windows.Forms.MessageBox.Show(sb.ToString());*/
return portInfo;
}
开发者ID:rasadeyan,项目名称:RestlessHoneySeeker,代码行数:26,代码来源:FirewallManager.cs
示例16: Server
public Server()
{
path = Directory.GetCurrentDirectory();
configFile = Path.Combine(path, "patients.json");
try
{
Console.WriteLine("loading session");
patients = JsonCommunication.loadPatientsJson(configFile);
}
catch (Exception)
{
Console.WriteLine("no sessions to load");
patients = new List<Patient>(); // to be replaced with list loaded from patient document
}
serverListener = new TcpListener(IPAddress.Any, Port);
serverListener.Start();
Console.WriteLine("Server gestart, wachten op verbindingen...\r\n");
while (true)
{
Console.WriteLine("Wachten op verbindingen...\r\n");
TcpClient tcp = serverListener.AcceptTcpClient();
new Thread(Handler).Start(tcp);
Console.WriteLine("Nieuwe verbinding geaccepteerd.\r\n");
}
}
开发者ID:MaurodeLyon,项目名称:IP2,代码行数:26,代码来源:Server.cs
示例17: GetAll
public static List<Author> GetAll()
{
List<Author> allAuthors = new List<Author> {};
SqlConnection conn = DB.Connection();
conn.Open();
SqlDataReader rdr = null;
SqlCommand cmd = new SqlCommand ("SELECT * FROM authors;", conn);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
int authorId = rdr.GetInt32(0);
string authorName = rdr.GetString(1);
Author newAuthor = new Author (authorName, authorId);
allAuthors.Add(newAuthor);
}
if (rdr != null)
{
rdr.Close();
}
if (conn != null)
{
conn.Close();
}
return allAuthors;
}
开发者ID:CrucialGier,项目名称:Library-Database,代码行数:28,代码来源:Author.cs
示例18: DataBaseSingleton
public DataBaseSingleton()
{
Console.WriteLine("Создание объекта класса DataBaseSingleton");
_employeesList = new List<Employee>();
CreateTestRecords();
}
开发者ID:Jaitl,项目名称:employees-manager,代码行数:7,代码来源:DataBaseSingleton.cs
示例19: GetString
public static string GetString(Container container)
{
StringBuilder result = new StringBuilder();
List<byte> bytes = new List<byte>();
byte[] containerBytes = container.GetData().ToArray();
for (int i = 0; i < 3; i++)
{
PrintLine(result, containerBytes[i]);
}
foreach (Frame frame in container.Frames)
{
result.AppendLine(string.Empty);
result.Append(GetString(frame));
foreach (Chunk chunk in frame.Chunks)
{
result.AppendLine(string.Empty);
byte[] output = chunk.GetData().ToArray();
foreach (byte b in output)
{
PrintLine(result, b);
}
}
}
return result.ToString();
}
开发者ID:jubalh,项目名称:Sxz,代码行数:28,代码来源:Print.cs
示例20: GetAll
public static List<Book> GetAll()
{
List<Book> allBooks = new List<Book>();
SqlConnection connection = DB.Connection();
connection.Open();
SqlCommand command = new SqlCommand("SELECT * FROM books;", connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
int id = reader.GetInt32(0);
string title = reader.GetString(1);
Book book = new Book(title, id);
allBooks.Add(book);
}
if (reader != null)
{
reader.Close();
}
if (connection != null)
{
connection.Close();
}
return allBooks;
}
开发者ID:Rick1970,项目名称:library,代码行数:28,代码来源:Book.cs
注:本文中的Library.List类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论