E
E
eskims2021-09-07 17:48:34
C++ / C#
eskims, 2021-09-07 17:48:34

Put data from array into string?

I don’t really understand the question, so I apologize in advance for my possible nonsense.

There is a problem, how to put data from the string[] array into a string?
For example array: "John, Alex, Scott"
Tried to do this:
string pname = pnames[0];
and write "John" to pname, but gives the error "Object reference not set to an instance of an object."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-09-08
@vabka

Object reference not set to an instance of an object

Somewhere there was null.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question