简体   繁体   English

添加多数组的字符串值

[英]add the string value for multi array

i want to add the string value for array using pointer in C#.我想在 C# 中使用指针为数组添加字符串值。 it look like the code as below:它看起来像下面的代码:

public static string[,] Matrixgroup = new string[199, 3];

void a()
{
    string*[0,0] Matrixgroup = {"A"};
}

can anybody here help me?这里有人可以帮助我吗?

Unlike you will have seen in your C/C++ background, string has become it's own type.与您在 C/C++ 背景中看到的不同, string已成为它自己的类型。 You can stop thinking of strings as pointers to character arrays: they are now a specific type.您可以停止将字符串视为指向字符数组的指针:它们现在是一种特定类型。

I think you are just trying to initialize one of the strings, which you could do like this...我认为您只是想初始化其中一个字符串,您可以这样做...

    string[,] Matrixgroup = new string[199, 3];
    Matrixgroup[0,0]= "A";

But it might be useful to know that you can initialise them all at once (if you know all the values), as shown in multidimensional arrays .但是知道您可以一次初始化它们可能很有用(如果您知道所有值),如多维数组所示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM