473,761 Members | 10,684 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to define System.Collecti ons.Generic.ICo llection<feedim age>

23 New Member
Hi i'm trying to pass a field of type
System.Collecti ons.Generic.ICo llection< FeedImage>
to a function.
I dont't have a clue what this icollection is.
but i tried some code

System.Collecti ons.Generic.ICo llection< FeedImage> imagea ;

FeedImage fee = new FeedImage ("http://www.image.com/image.jpg", "http://www.image.com") ;

imagea.Add(fee) ;

but i get an error that imagea is undefined but i don't know how to define it.

I tried System.Collecti ons.Generic.ICo llection< FeedImage> imagea = new System.Collecti ons.Generic.ICo llection< FeedImage> ();

and loads of other ways but they didn't work either.

I treid :
System.Collecti ons.Generic.ICo llection< FeedImage> imagea =null
but its generate a null error

someone help me please
Oct 23 '07 #1
2 2639
nateraaaa
663 Recognized Expert Contributor
Hi i'm trying to pass a field of type
System.Collecti ons.Generic.ICo llection< FeedImage>
to a function.
I dont't have a clue what this icollection is.
but i tried some code

System.Collecti ons.Generic.ICo llection< FeedImage> imagea ;

FeedImage fee = new FeedImage ("http://www.image.com/image.jpg", "http://www.image.com") ;

imagea.Add(fee) ;

but i get an error that imagea is undefined but i don't know how to define it.

I tried System.Collecti ons.Generic.ICo llection< FeedImage> imagea = new System.Collecti ons.Generic.ICo llection< FeedImage> ();

and loads of other ways but they didn't work either.

I treid :
System.Collecti ons.Generic.ICo llection< FeedImage> imagea =null
but its generate a null error

someone help me please
Try this code it should do the same thing.

List< FeedImage> imagea = new List<FeedImage> ();

You can also loop through the collection list with this code.
foreach(FeedIma ge feedImage in imagea)
{
//do something here
}

Read up on C# Generics to get a better understanding of what their benefits are.

Nathan
Oct 23 '07 #2
Plater
7,872 Recognized Expert Expert
System.Collecti ons.Generic.ICo llection is an interface. You will need to find an inheriting class. Anything in System.Collecti ons.Generic should work (according to msdn)
Try:
Expand|Select|Wrap|Line Numbers
  1. LinkedList<FeedImage> = new LinkedList<FeedImage>();
  2.  
Oct 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
4377
by: Doug Dew | last post by:
This won't compile: using IEnumerable<T> = System.Collections.Generic.IEnumerable<T>; namespace MyNamespace { public class MyClass<T> : IEnumerable<T> { // Appropriate stuff here }
3
15182
by: Abhi | last post by:
In the following hypothetical example I want to build a generic list of unique string items. How should I implement the pred function so that it returns true/false if target string exists in the generic list...is not clear to me. Any suggestions? System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(); foreach(string s in myAnotherArray)
6
5946
by: Paul Delhanty | last post by:
Hi, I am converting an existing native C++ program making heavy use of STL to C#2.0 with STL usage replaced by the new generic collections. The conversion has gone well to the point where I am replacing an STL map instance by a System.Collections.Generic.SortedDictionary instance. In need the collection to be ordered, and to have o(log(n)) look up - that is fine so far SortedDictionary.TryGetValue does the job. I also need the...
2
3310
by: ljlevend | last post by:
I've noticed that in VS.NET 2.0 Beta 1 that none of the methods in System.Collections.Generic.List are overridable. In my app I currently have over 50 strongly typed ArrayLists that inherit from System.Collections.ArrayList. Each of these types raise strongly typed events for when items are added and removed (e.g., AddingItem, AddedItem, CollectionChanged, etc.). One of my hopes for v2.0 was to create a single generic List that replaces...
4
8191
by: nhmark64 | last post by:
Hi, Does System.Collections.Generic.Queue not have a Synchronized method because it is already in effect synchronized, or is the Synchronized functionality missing from System.Collections.Generic.Queue? Putting it another way can I safely replace a System.Collections.Queue.Synchronized(myUnSynchronizedQueue) with a System.Collections.Generic.Queue while porting a working 2003 project? Thanks,
2
2065
by: newscorrespondent | last post by:
I have a list declared: public System.Collections.Generic.SortedList<int, System.Collections.Generic.List<MTGTracer ActiveList = new SortedList<int,List<MTGTracer>>(); The key is an integer and the value is a list of MTGTracer. The documentation states:
2
2054
by: Polaris431 | last post by:
A property in some class shows up in the object browser as follows: public System.Collections.Generic.ICollection<DataSourceDataSources { get; } How do I access this property. I'm not sure what the <DataSource> implies. How do I define the variable that this property gets set to?
2
7361
by: Fred Heida | last post by:
Hi, i'm trying to (using managed C++) implment the IEnumerable<Tinterface on my class.. but have a problem with the 2 GetEnumerator method required.... what i have done is... generic<typename T> public ref class SetOfProxy : public System::Collections::Generic::IEnumerable<T>
0
1337
by: DR | last post by:
System.Collections.Generic.List<intmyList = new System.Collections.Generic.List<int>(100); Does this preallocate 100 integers? Also, is there any way to preallocate an array of objects all at once? MyOb al= new MyOb; for (int z = 0; z < nCount; z++)
0
9521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.