Click here to Skip to main content
15,908,254 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Question with Generics Pin
mike montagne27-Feb-07 19:24
mike montagne27-Feb-07 19:24 
GeneralRe: C# Question with Generics Pin
mike montagne28-Feb-07 6:25
mike montagne28-Feb-07 6:25 
GeneralRe: C# Question with Generics Pin
mike montagne28-Feb-07 7:06
mike montagne28-Feb-07 7:06 
GeneralRe: C# Question with Generics Pin
mike montagne28-Feb-07 7:09
mike montagne28-Feb-07 7:09 
GeneralRe: C# Question with Generics Pin
mike montagne28-Feb-07 8:14
mike montagne28-Feb-07 8:14 
AnswerRe: C# Question with Generics Pin
Colin Angus Mackay21-Feb-07 22:09
Colin Angus Mackay21-Feb-07 22:09 
GeneralRe: C# Question with Generics Pin
malharone22-Feb-07 7:03
malharone22-Feb-07 7:03 
AnswerRe: C# Question with Generics Pin
darkelv22-Feb-07 0:42
darkelv22-Feb-07 0:42 
I am not sure if this is what you want:

<br />
class DBStore<T> where T : class, new()<br />
{<br />
    public T CreateObject()<br />
    {<br />
        return new T();<br />
    }<br />
    public void DeleteObject<T>(int id)<br />
    {<br />
        Type t = typeof(T);<br />
        // Do you stuff here using theObject;<br />
    }<br />
    public DBStore()<br />
    {<br />
    }<br />
}<br />
abstract class DomainObject<T> where T : class, new()<br />
{<br />
    protected int _id;<br />
    protected DBStore<T> _dbStore;<br />
    public void Delete ()<br />
    {<br />
        _dbStore.DeleteObject<T>(_id);<br />
    }<br />
}<br />
class Boat : DomainObject<Boat><br />
{<br />
    public Boat()<br />
    {<br />
    }<br />
    public Boat(int id)<br />
    {<br />
        this._id = id;<br />
        this._dbStore = new DBStore<Boat>();<br />
    }<br />
}<br />
class Car : DomainObject<Car><br />
{<br />
    public Car()<br />
    {<br />
    }<br />
    public Car(int id)<br />
    {<br />
        this._id = id;<br />
        this._dbStore = new DBStore<Car>();<br />
    }<br />
}<br />
<br />
class TestClass<br />
{<br />
    public void Run()<br />
    {<br />
        Boat boat = new Boat(1234);<br />
        boat.Delete();<br />
<br />
        Car car = new Car(5678);<br />
        car.Delete();<br />
    }<br />
}<br />

GeneralRe: C# Question with Generics Pin
malharone22-Feb-07 7:49
malharone22-Feb-07 7:49 
GeneralRe: C# Question with Generics Pin
malharone27-Feb-07 11:13
malharone27-Feb-07 11:13 
QuestionStart reading at the end of a file? Pin
TheJudeDude21-Feb-07 14:05
TheJudeDude21-Feb-07 14:05 
AnswerRe: Start reading at the end of a file? Pin
Shajeel21-Feb-07 18:54
Shajeel21-Feb-07 18:54 
GeneralRe: Start reading at the end of a file? Pin
TheJudeDude22-Feb-07 3:31
TheJudeDude22-Feb-07 3:31 
GeneralRe: Start reading at the end of a file? Pin
Luc Pattyn22-Feb-07 8:08
sitebuilderLuc Pattyn22-Feb-07 8:08 
QuestionISerializable.GetObjectData Method Example Pin
Gywox21-Feb-07 11:53
Gywox21-Feb-07 11:53 
AnswerThats a lot of code Pin
Ennis Ray Lynch, Jr.21-Feb-07 12:48
Ennis Ray Lynch, Jr.21-Feb-07 12:48 
GeneralRe: Thats a lot of code Pin
Gywox21-Feb-07 23:23
Gywox21-Feb-07 23:23 
GeneralRe: Thats a lot of code Pin
Ennis Ray Lynch, Jr.22-Feb-07 2:45
Ennis Ray Lynch, Jr.22-Feb-07 2:45 
Questionmodal popup Pin
netJP12L21-Feb-07 10:08
netJP12L21-Feb-07 10:08 
QuestionChanging the Size of a Panel [modified] Pin
aei_totten21-Feb-07 9:23
aei_totten21-Feb-07 9:23 
AnswerRe: Changing the Size of a Panel Pin
Luc Pattyn21-Feb-07 10:53
sitebuilderLuc Pattyn21-Feb-07 10:53 
QuestionVisual Studio 2003 and Crystal Report Viewer Pin
Saamir21-Feb-07 9:07
Saamir21-Feb-07 9:07 
QuestionMouse following movements C# Pin
Dang3russ21-Feb-07 8:33
Dang3russ21-Feb-07 8:33 
AnswerRe: Mouse following movements C# Pin
led mike21-Feb-07 8:55
led mike21-Feb-07 8:55 
Questionhow to save xml file via web service Pin
BraveShogun21-Feb-07 7:20
BraveShogun21-Feb-07 7:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.