Home
Forums
Programming
Web Development
Tutorials
Snippets
Blogs
Freelance
Jobs
Chat
Lounge
Login
Join for Free!
Programming Help
C and C++
Visual Basic
Java
VB.NET
C#
ASP.NET
PHP
ColdFusion
Perl and Python
Ruby
Databases
Other Languages
Game Programming
Software Development
Computer Science
Industry News
Web Development
Web Development
HTML & CSS
JavaScript
Graphic Design
Flash & ActionScript
Blogging
SEO & Advertising
Web Servers & Hosting
Site Check
What's Here?
Members:
132,685
Replies:
471,787
Topics:
73,153
Snippets:
2,541
Tutorials:
667
Total Online:
1,256
Members:
68
Guests:
1,188
Who's Online?
Smurphy
cystal1
Amadeus
eXceed69
samt53
stauffski
abgorn
MikeAmin
onehouse
Simo_fcis
walkera60
Alexader1
vemuri.kishore
vincent813
Argmaster
[X]
My Assistant
Loading. Please Wait...
Dream.In.Code
>
Programming Help
>
C#
Welcome to Dream.In.Code
Getting C# Help is Easy!
Join 132,685 C# Programmers for FREE!
Get instant access to thousands
of C# experts, tutorials, code snippets, and more! There are 1,256 people online right now.
Registration is fast and FREE...
Join Now!
Chat
LIVE
With a C# Expert
returning an array of an interface
returning an array of an interface
Options
johnholton
2 Jun, 2008 - 12:49 AM
Post
#1
New D.I.C Head
Joined: 22 Apr, 2008
Posts: 4
I've defined and Interface call IBar. Bar inherits from this IBar
now I have a function call, but the last line fails. How do I return an array of interfaces?
IBar [] getAllBars()
{
Bar [] b = new Bar[100];
return b;
}
This Post Was Helpful!
New!
Register for Free to Make These Ads Go Away!
baavgai
2 Jun, 2008 - 03:23 AM
Post
#2
Dreaming Coder
Joined: 16 Oct, 2007
Posts: 1,967
Thanked 96 times
Dream Kudos:
475
Expert In:
C, C++, Java, C#, ASP.NET, PHP, Perl, Python, Oracle, SQL Server, MySql, HTML, JavaScript, Lua
My Contributions
Looks ok. You can try this:
CODE
return (IBar [])b;
or this
CODE
IBar [] b = new Bar[100];
Either should work.
This Post Was Helpful!
New!
Display Mode:
Standard
·
Switch to: Linear+
·
Switch to: Outline
Track this topic
·
Email this topic
·
Print this topic
·
Subscribe to this forum
Time is now: 11/23/08 07:06AM
Invision Power Board
v2.1.7 © 2008 IPS, Inc.
Licensed to: MediaGroup1
Advertising
|
Terms of Use
|
Privacy Policy
|
About Us
|
Site Map
Forum Index:
Programming Help
|
C and C++
|
Visual Basic
|
Java
|
VB.NET
|
C#
|
ASP.NET
|
PHP
|
ColdFusion
|
Perl and Python
|
Ruby
|
Databases
|
Other Languages
|
Game Programming
|
Software Development
|
Computer Science
|
Industry News
|
Programming Tutorials
|
C++ Tutorials
|
Visual Basic Tutorials
|
Java Tutorials
|
VB.NET Tutorials
|
C# Tutorials
|
PHP Tutorials
|
Linux Tutorials
|
ColdFusion Tutorials
|
Windows Tutorials
|
HTML/JavaScript Tutorials
|
CSS Tutorials
|
Flash Tutorials
|
Web Promotion Tutorials
|
Photoshop Tutorials
|
Software Development Tutorials
|
Database Tutorials
|
Other Language Tutorials
|
Copyright 2001-2008
MediaGroup1 LLC
, All Rights Reserved
A
MediaGroup1 LLC
Production - Version 6.0.2.1.36
Search
Updated!
w00t
Over 509,000 Pages!
Advanced Forum Search
Live C# Help!
C# Tutorials
Serial Port Communication in C#
Basic Client/Server Chat Application in C#
C# Basics Quick Reference (Cheat Sheet)
Create an AutoComplete TextBox Control in C#
C# - Reading each character of a string
Cross Thread Communication in C#
Basic Calculator in C#
C# Flags
Disable an applications close button
Read config file in Class Library
68 More C# Tutorials...
Reference Sheets
C# Snippets
Populating Tree View nodes from sql server 2000
Get connection string from the web.config
Read value from Resource file in C#
Validate IP address with Regular Expression
TreeView Drag n Drop
Search Text file for String
Clear a form
DataGridView - Get Selected List
Get checked item in gridView (ASP.Net) and store in session
Find all classes within a Namespace
246 More C# Snippets...
Bye Bye Ads
Free
DIC
T-Shirt
Related Sites
DayDream Graphics
Scripts
PhotoshopForums.com
DeveloperCube
WebDevBooks.com
CommunityAdmins.com
CommunityPromotion.com
Monthly Drawing
Partners
BizTalk Adaptors
Planet Source Code
ASPAlliance
Top Contributors
Top 10 Kudos This Month
AdamSpeight2008
(125)
kiwi2
(125)
Psionics
(100)
jacobjordan
(75)
muballitmitte
(75)
OliveOyl3471
(50)
TheAKB
(50)
Malazar
(50)
jens
(50)
captainhampton
(50)