Code in 1.1 That doesn't work in 2.0
Here is the code that gives me trouble:
Code:
m_alFriends = ArrayList.Synchronized(new ArrayList(25));
I Declared m_alFriends like so:
Code:
private List<Friends.Friend> m_alFriends;
I changed that from:
Code:
private ArrayList m_alFriends;
I get the following error:
Code:
Error 7 Cannot implicitly convert type 'System.Collections.ArrayList' to 'System.Collections.Generic.List<Defiance.Bncs.Friends.Friend>' C:\Documents and Settings\JoeL Zimmerman\My Documents\My Programming\C#\8.0\Defiance\Defiance.Connection\BNCS\OpenGameProtocol.cs 764 31 Defiance.Connections
Re: Code in 1.1 That doesn't work in 2.0
The ArrayList and the Generic.List(Of T) are completely different types. You cannot create a synchronised ArrayList and assign it to a Generic.List(Of T) variable. You need to create a synchronised Generic.List(Of T). The Generic.List(Of T) type doesn't have a Synchronized method though, so I'm not sure if it's possible. You may have to use lock statements to manually synchronise access to your collection.