I've inherited an existing 2.0 framework asp.net web application.

The function returns a value of Icollection, but it says ICollection is not defined. I can import System.Collections, but I still wonder how it worked for them if they didn't have this imported.

They are only using these imports:

Imports System.Data
Imports System.Data.OracleClient
Imports System.Web.Configuration

Should I just import the ICollection and be done with it?

Also, the function has created an objCollection and is returning that object. But the function itself indicates it is returning the ICollection interface.

Is there an issue here? Is that normal?


Starr DuskkASP.NET VB.NET DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I'm assuming this is related to the question you posted a few minutes after this on the 2005 - 2008 upgrade?
If so, I would take a guess that something was lost in the project file during conversion, they could have had System.Collections in the project-wide "Imported namespaces", might have been dropped during the upgrade.
You're probably fine adding either directly to the page or back into the project imports area.

As for the ICollection return, it's perfectly fine.  That's one of the primary functions of an interface, to allow multiple different types of objects to be returned, as long as they impliment the same interface.
In the block calling the function, you then don't need to worry about what exact type of object it is.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.