I have a concurrentqueue which contains class objects, I want to take those objects and put them into a observable collection of the same class object. (basically copying/moving it from the concurrentqueue to the collection.)
Here I add the elements into the concurrent queue during a multithreaded process.
sTumblrblog_gv_concurqueue.Enqueue(new sTumblrblog_gv() { Title = tumblrusrfollow.Title, Url = tumblrusrfollow.Url.ToString(), AvatarImage = imageavatar, BlogPosts = blogposts, IsNsfw = blogisnfw });
And then I want to take them out of that and put them into an observable collection. Without any duplicate objects (or objects with the same url in them.
if (!sTumblrblog_gv_list.Any(p => p.Url == tumblrusrfollow.Url))
{
sTumblrblog_gv Queue2ObsCollection = new Queue2ObsCollection;
Queue2ObsCollection =(sTumblrblog_gv)sTumblrblog_gv_concurqueue.TryDequeue();
sTumblrblog_gv_list.Add(new sTumblrblog_gv() { Title = Queue2ObsCollection.Title , Url = Queue2ObsCollection.Url, AvatarImage = Queue2ObsCollection.AvatarImage, BlogPosts = Queue2ObsCollection.BlogPosts, IsNsfw = Queue2ObsCollection.IsNsfw});
}
I currently get "Error CS1526 A new expression requires (), [], or {} after type" This probably isn't the best way to do this and any thoughts are welcome.