S
S
SNAKEJA2014-08-20 14:27:54
C++ / C#
SNAKEJA, 2014-08-20 14:27:54

How to store the result of a function in an array?

Hi all.
There is a method that works with api.vk and returns the result as strings.
From them, I need to pull out certain values.
How can you assign the result of a method that returns a string type to the string[] array, so that you can then iterate through it using for.
Here's what I want to get:

link= GetWall(); // Вот тут вылетает ошибка Error 1 Cannot implicitly convert type 'string' to 'string[]'
            link.Substrings("date:", ",", 0);
            for (int i = 0; i < link.Length; i++)
            {
                MessageBox.Show(link[i]);
            }

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Mozhaykin, 2014-08-20
@smozhaykin

Did not work with api.vk, but it probably returns data as a string, which is JSON. Use any of the prebuilt libraries to deserialize JSON data.

D
dobriykot, 2014-08-21
@dobriykot

If you need to cut a delimited string into pieces, then use the String.Split method .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question