What is the best way to convert a string list to a class list?

I’ve retrieved WWW data and put it into a string array, removed the delimiter. Now I want to put it into a list an instantiate a prefab. I used linq to make it into a list. Strange thing is, there are three items taken from the database and the count reads as four.

        WWW VehicleData = new WWW ("http://localhost/CMVM/LoadVehicle.php"); 
		yield return VehicleData;

		Debug.Log (VehicleData.text);
		string TheVehicleData = VehicleData.text;
		string[] VehiclesArray = TheVehicleData.Split ('/');

		VehicleIndexList = VehiclesArray.ToList();
		Debug.Log (VehicleIndexList.Count);

The other issue is an error

 Cannot implicitly convert type `System.Collections.Generic.List<string>' to `System.Collections.Generic.List'

I’ve tried using cast, I’ve tried using as and the standard ()

VehicleIndexList = (VehicleIndex)VehiclesArray.ToList() as VehicleIndex; 

This give the error Cannot convert type `System.Collections.Generic.List’ to VehicleIndex’

VehicleIndexList = VehiclesArray.Cast<VehicleIndex>().ToList(); 

This gives the error InvalidCastException: Cannot cast from source type to destination type. Which means the parameters aren’t right

I’ve also tried using just the array, only I don’t know how to instantiate a prefab from an array.
I hope someone can help me out of this jam.
Thanks!

First you have one extra because your data most likely looks like:

 /data/data/data/

so it cuts it in 4.

You could check if the last is / and trim:

 if(data[data.Length - 1] == '/'){ data.TrimEnd('/'); }

Second you should show what type is VehicleIndexList. Sounds like you are not using a generic version of it.

  List<string>VehicleIndexList  = new List<string>( VehiclesArray);

But if you do not plan on changing the collection, then there is little point in doing so. If the purpose was to remove the last empty entry, using trimming from above will do it.

What exactly are you trying to do?
How do you want to convert a string to a class? That doesn’t make much sense?
Does the constructor of the class take in the string or something?
Then you could do something like:

var VehicleIndexList = VehiclesArray.Select(f => new VehicleIndex(f)).ToList();

Can you show us the VehicleIndex class?

What exactly are you trying to do?
How do you want to convert a string to a class? That doesn’t make much sense?
Does the constructor of the class take in the string or something?
Then you could do something like:

var VehicleIndexList = VehiclesArray.Select(f => new VehicleIndex(f)).ToList();

Can you show us the VehicleIndex class?