Click here to Skip to main content
15,891,033 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Memory management and memory leaks Pin
originSH26-Jun-07 2:44
originSH26-Jun-07 2:44 
QuestionHow to build a IP LAN Scanner in .Net Pin
Carmine_XX25-Jun-07 4:49
Carmine_XX25-Jun-07 4:49 
AnswerRe: How to build a IP LAN Scanner in .Net Pin
Ilya Verbitskiy8-Jul-07 1:18
Ilya Verbitskiy8-Jul-07 1:18 
GeneralRe: How to build a IP LAN Scanner in .Net Pin
Carmine_XX8-Jul-07 4:41
Carmine_XX8-Jul-07 4:41 
GeneralRe: How to build a IP LAN Scanner in .Net Pin
Ilya Verbitskiy8-Jul-07 21:19
Ilya Verbitskiy8-Jul-07 21:19 
QuestionGenerics, Inheritance and frustration Pin
Santiago Perez25-Jun-07 2:38
Santiago Perez25-Jun-07 2:38 
AnswerRe: Generics, Inheritance and frustration Pin
Andy L 225-Jun-07 7:10
Andy L 225-Jun-07 7:10 
GeneralRe: Generics, Inheritance and frustration Pin
Santiago Perez25-Jun-07 8:32
Santiago Perez25-Jun-07 8:32 
With this scenario I would have to cast property Personnel_List everytime I need to get a property value from one of the derived objects. Doesn't this defeat the purpose of Generics? I guess I'm trying find the most efficient and scalable way to do this.

I tried a different approach as follows. I can't seem to find a way to have the Base class properties populated without having to re-wite the property assignment code in the derived classes.
Anyone encountered this before?


using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
B objB = new B();
List oBList = new List();
objB.GenerateList(ref oBList);

}
}

public interface iClass
{
string Full_Name
{
get;
set;
}

string Short_Name
{
get;
set;
}
}


public class A : iClass
{
private string _PhoneA = "";
private string _Full_Name = "";
private string _Short_Name = "";

public string PhoneA
{
get { return _PhoneA; }
set { _PhoneA = value; }
}

public string Full_Name
{
get { return _Full_Name; }
set { _Full_Name = value; }
}
public string Short_Name
{
get { return _Short_Name; }
set { _Short_Name = value; }
}

public virtual void GenerateList(ref List List)
{
A objA = new A();
objA.Full_Name = "Tom";
List.Add(objA);

objA = new A();
objA.Full_Name = "Bob";
List.Add(objA);

objA = new A();
objA.Full_Name = "Gerry";
List.Add(objA);

}

}


class B : A, iClass
{
private string _SSN = "";

public string SSN
{
get { return _SSN; }
set { _SSN = value; }
}


public new void GenerateList(ref List List)
{
base.GenerateList(ref List);

foreach (B oB in List)
{
oB.SSN = "123";
}

}
}
}

GeneralRe: Generics, Inheritance and frustration Pin
Andy L 226-Jun-07 0:16
Andy L 226-Jun-07 0:16 
GeneralRe: Generics, Inheritance and frustration Pin
Santiago Perez26-Jun-07 16:41
Santiago Perez26-Jun-07 16:41 
GeneralRe: Generics, Inheritance and frustration Pin
Santiago Perez26-Jun-07 18:28
Santiago Perez26-Jun-07 18:28 
GeneralRe: Generics, Inheritance and frustration Pin
Santiago Perez26-Jun-07 20:19
Santiago Perez26-Jun-07 20:19 
GeneralRe: Generics, Inheritance and frustration Pin
Andy L 226-Jun-07 22:37
Andy L 226-Jun-07 22:37 
GeneralRe: Generics, Inheritance and frustration Pin
Santiago Perez27-Jun-07 5:05
Santiago Perez27-Jun-07 5:05 
GeneralRe: Generics, Inheritance and frustration Pin
Santiago Perez27-Jun-07 5:29
Santiago Perez27-Jun-07 5:29 
GeneralRe: Generics, Inheritance and frustration Pin
Santiago Perez27-Jun-07 5:45
Santiago Perez27-Jun-07 5:45 
GeneralRe: Generics, Inheritance and frustration Pin
Santiago Perez28-Jun-07 7:34
Santiago Perez28-Jun-07 7:34 
GeneralRe: Generics, Inheritance and frustration Pin
Andy L 229-Jun-07 5:33
Andy L 229-Jun-07 5:33 
QuestionXML 3 BulkLoad Error Pin
Panchal Hardik25-Jun-07 2:25
Panchal Hardik25-Jun-07 2:25 
AnswerRe: XML 3 BulkLoad Error Pin
Dave Kreskowiak25-Jun-07 4:04
mveDave Kreskowiak25-Jun-07 4:04 
Questioninstallation .net 2005 Pin
Sumanth Pereji25-Jun-07 2:19
Sumanth Pereji25-Jun-07 2:19 
AnswerRe: installation .net 2005 Pin
Dave Kreskowiak25-Jun-07 4:09
mveDave Kreskowiak25-Jun-07 4:09 
GeneralRe: installation .net 2005 Pin
Pete O'Hanlon25-Jun-07 5:13
mvePete O'Hanlon25-Jun-07 5:13 
GeneralRe: installation .net 2005 Pin
Dave Kreskowiak25-Jun-07 5:56
mveDave Kreskowiak25-Jun-07 5:56 
GeneralRe: installation .net 2005 Pin
Pete O'Hanlon25-Jun-07 8:32
mvePete O'Hanlon25-Jun-07 8:32 

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.