-
well, the problem is what's getting stored in your internal collection, not the cast. In your code url is string to begin with, so no cast would be necessary anyway. The problem is that you're storing something other than a devSingleItem in the ArrayList. Then when your indexer code runs it tries to cast an item in your ArrayList, which is a string type, to a devSingleItem type and that won't work. In my example I only store ButtonEx types in my internal collection so when my indexer is referenced it casts an item in my internal collection(which I already know only holds ButtonEx types) to a ButtonEx type, and all is good. But if I allow anything other than ButtonEx types to be added to my internal collection, my indexer would break as well. So the solution is gonna be something like adding only devSingleItems to your internal collection...
-
no...the arraylist has nothing there now..i changed the code and has nothing and still the error..
-
DAMN WORKED LOL..! it was the string..i first tryed casting string into object..but didnt work..well..whatever u god tkstkstks tks tks tks :D:D:D
-
so repost what your code looks like now.
-
-
PHP Code:
public void Add(string url, int buttonWidth, int buttonHeight)
{
_array.Add(new devSingleItem());
}
so now what i have to do is always i do an class.items.add() it creates a new devsintgleItem with all it's propreties set up and runnning very tks again :D
-
its kinda hard to start working like this i am not used to work with oop like this..but seems very nice :D good night time to sleep