CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > .net_languages.c Tags:
Item Type: Date Entered: 11/12/2009 12:00:21 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 0 Views: 9 Favorited: 0 Favorite
3 Items, 1 Pages 1 |< << Go >> >|
"twistedinferno
NewsGroup User
Generics? Inheritance, a bit confused.11/12/2009 12:00:21 PM

0

Hi

I have a bunch of custom entities that all inherit from a "baseEntity" class.

What I want to do is, in another class, create a method that takes a parameter that can be any type as long as that type inherits from base entity.

Is this possible?

Should I use generics?

public class BaseEntity
{
    public Nullable<int> UniqueId { get; set; }
    public Enums.eSaveAction SaveAction { get; set; }
}

public class FilesForTab : BaseEntity
{
    public int Related_Id { get; set; }
    public string FileName { get; set; }
    public Nullable<int> FileSize { get; set; }
}

(other class)

public void DoSomething(List<BaseEntity> collection, IEnumerable<BaseEntity> rows)
{....}

thanks in advance

 

"JeffreyABecker
NewsGroup User
Re: Generics? Inheritance, a bit confused.11/12/2009 12:44:05 PM

0

Yes google for generic constraints

"twistedinferno
NewsGroup User
Re: Generics? Inheritance, a bit confused.11/12/2009 1:34:22 PM

0

CONSTRAINTS!!!

thanks

public void DoSomething<X>(IEnumerable<X> rows, List<BaseEntity> sessionCollection) where X : BaseEntity
    {...}
 

that compiles!  (but have not actually run the code yet)

 

3 Items, 1 Pages 1 |< << Go >> >|


Free Download:







online employee schedualing system

installing new font in client machine

question about functions / procedures (c#)

frames please help

calculate the total of record fields in the current week

com wrapper

database insert

recording a hyperlink

image binding

c# hashtable getting values by key name

extracting the duration of a media file.

<%= vs <%#

reporting and sql/asp.net

convert hex to char

get the url ??

how to set back color for a given col in a grid view

span, viewstate

iis latency issue

where should the protected sub go?

web.config and payment gateway

what is the right way to store variables between postback? thanks.

totaling in a grid view

need help

loop through an alphanumeric set of strings

how to deployee .net apllication in server.

another auto email question

how to save file using c#.net

transport screenoutput to texfile

hi there

need help in sending emails through asp.net

vs 2005 and msde 2000

using asp pages in asp.net 2.0

getting a value from an databinder

chat

displaying thumbnails in rows and columns on a webpage

[ new account in 2 databases in the same time ]

added reference but not found

subdomains

how to sending a file from server to the client....

body section as user control or new page?

button attribute

page navigation

administration problem

how to switch tabpages in tabcontrol?

how to write data in word file

how to make web application more secure????

can some body please help me bind simple textbox so they can communicate with the database

how to launch a asp page from an exe file

error on registering

find div and delete backgound and title dynamically

   
  Privacy | Contact Us
All Times Are GMT