Looping through data file?
Hi,

I need to loop throught datafile.

I tryed:

            foreach (var obj in data.ReadObject<string>(filename))
            {
                PrintToChat(obj[key]);
            }​
but I getting error: Error CS0021 Cannot apply indexing with [] to an expression of type 'char'

What I can do with this?

Thanks alot.
You're reading a string and you are trying to loop through the string, so you're getting a char. And then you're trying to access an element of char with index of key.
Yes but I want to know how to make it work.
What exactly do you want it to do?
I want to get data from file. Mean get value by key
martys
I want to get data from file. Mean get value by key
How do you expect string to be a key-value object? If you want to get KV pairs - then you need to deserialize data into that format (and obviously - file should contain this data)