A
A
Anton Hidden2016-02-16 22:00:32
Arrays
Anton Hidden, 2016-02-16 22:00:32

How to create an array that has data(name, text, information)?

Good evening! Straight to the point, I can't save data to an array. Example:

class TrainingPro
    {
        public string NameTraining { get; set; }
        public string InitialPosition { get; set; }
        public string HowToTraining { get; set; }
        public string Сomplication { get; set; }
        public TrainingPro (string NAME, string IP, string HTT, string CMP)
        {
            NameTraining = NAME;
            InitialPosition = IP;
            HowToTraining = HTT;
            Сomplication = CMP;
        }
*/----------------------------------------------------------------------------------------------------------------------------------------------------------------------------/*
static void Main(string[] args)
        {
            TrainingPro[] docs = new TrainingPro[]
           {
               docs=new docs { "Подкручивание таза1","Исходное положение1.","Как выполнять1."," "},
                        new docs { "Подкручивание таза2","Исходное положение2.","Как выполнять2."," "} 
           };
*/----------------------------------------------------------------------------------------------------------------------------------------------------------------------------/*
Console.WriteLine("NameTraining  = {0} InitialPosition= {1} HowToTraining= {2}  Сomplication= {3}", docs.NameTraining , docs.InitialPosition , docs.HowToTraining, docs.Сomplication);

  • What do I understand wrong?
  • Not even what am I doing wrong?
  • Give examples of how to do it or information on similar literature.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2016-02-16
@antonsk2013

What are you doing wrong? feverish nonsense is written in the comments. Have you tried opening the syntax tutorial at all? or decided to master the language by the method of scientific poke?
Well, it can be easier.

TrainingPro[] docs = new TrainingPro[someLength];
         for(int i=0;i<someLength;i++)
        {
            docs[i] = new TrainingPro("NAME"+i, "IP"+i,"HTT"+i,"CMP"+i);
        }

Buy, download Schildt's textbook on C# syntax and please don't ask questions like this one. If you do not understand such instructions, programming is not your calling.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question