using
System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.Title = "This is a Test";
Test();
Console.ReadLine();
}
static void Test()
{
Func<string, string> select = str => str.ToUpper();
string[] names = { "a", "b", "e","e","n" };
var mynames = names.Select(select).ToArray();
var queue = new Queue();// 队列
foreach (var item in mynames)
{
queue.Enqueue(item);// 入队
}
Array.ForEach<Object>(queue.ToArray(), str => Console.WriteLine(str));
queue.Dequeue(); // 出队
Console.WriteLine("===================分隔线===================");
Array.ForEach<Object>(queue.ToArray(), str => Console.WriteLine(str));
}
}
}
output:
A
B
E
E
N
===================分隔线===================
B
E
E
N
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.Title = "This is a Test";
Test();
Console.ReadLine();
}
static void Test()
{
Func<string, string> select = str => str.ToUpper();
string[] names = { "a", "b", "e","e","n" };
var mynames = names.Select(select).ToArray();
var queue = new Queue();// 队列
foreach (var item in mynames)
{
queue.Enqueue(item);// 入队
}
Array.ForEach<Object>(queue.ToArray(), str => Console.WriteLine(str));
queue.Dequeue(); // 出队
Console.WriteLine("===================分隔线===================");
Array.ForEach<Object>(queue.ToArray(), str => Console.WriteLine(str));
}
}
}
output:
A
B
E
E
N
===================分隔线===================
B
E
E
N