分割字符串数组后如何获取值?

-1 c#

我有以下问题.分裂之后我想把作者,标题和booktype变成这样的变量.

string author = George Orwell
string title = Animal Farm
string booktype = novel
Run Code Online (Sandbox Code Playgroud)

使用foreach循环打印它们很容易,但我如何获得这些值?希望有人能帮助我.

static void Main(string[] args)
{
    string[] book = new string[12];
    book[0] = "George Orwell###Animal Farm###Novel###";
    string value = book[0];
    string[] item = Regex.Split(value, "###");

    foreach (string newItem in item)
    {
        Console.WriteLine(newItem);
    }
    // prints out just fine

    // George Orwell
    // Animal Farm
    // Novel
    Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)

Jam*_*iec 8

拆分字符串:

string[] item = Regex.Split(value, "###");
Run Code Online (Sandbox Code Playgroud)

你有一个阵列.你知道第一个元素是名称,第二个是标题,第三个是类型

string author = item[0];
string title = item[1];
string booktype = item[2];
Run Code Online (Sandbox Code Playgroud)

你应该在尝试阅读它们之前做一些验证,但实质上就是这样.