我是初学者 [英] I'm a beginner
问题描述
我想知道如何在单个变量中输入多个值。
I want to know how I can enter more than one value in a single variable.
推荐答案
单个变量只能容纳一个变量。时间 也许您正在寻找结构,这可以让您创建一个包含多个字段的新类型。
A single variable can only hold one thing at a time. Perhaps you are looking for structures, which lets you create a new type that contains several fields.
  public struct学生{
     公共字符串名称;
      public int年龄;
     公共字符串学校
  }
public struct Student {
public string Name;
public int Age;
public string School
}
 学生st;
  st.Name =" Tim Roberts";
  st.Age = 93;
  st.School =" Oregon Start";
Student st;
st.Name = "Tim Roberts";
st.Age = 93;
st.School = "Oregon Start";
这篇关于我是初学者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!