Click here to Skip to main content
15,890,670 members
Home / Discussions / C#
   

C#

 
GeneralRe: 2d drawing (visualstudio2005) Pin
Henry Minute3-May-09 4:24
Henry Minute3-May-09 4:24 
GeneralRe: 2d drawing (visualstudio2005) Pin
lor3n7o3-May-09 4:34
lor3n7o3-May-09 4:34 
QuestionError related access-" Record(s) cannot be read; no read permission on 'MSysObjects '" Pin
KIDYA3-May-09 2:08
KIDYA3-May-09 2:08 
AnswerRe: Error related access-" Record(s) cannot be read; no read permission on 'MSysObjects '" Pin
MumbleB3-May-09 2:54
MumbleB3-May-09 2:54 
QuestionAre "Master pages" ASP.NET's answer to Template Engine for .NET 2.0? Pin
Member 3653373-May-09 2:00
Member 3653373-May-09 2:00 
AnswerRe: Are "Master pages" ASP.NET's answer to Template Engine for .NET 2.0? Pin
saanj3-May-09 21:21
saanj3-May-09 21:21 
QuestionGenerics return type cannot cast. Pin
NT9863-May-09 0:40
NT9863-May-09 0:40 
AnswerRe: Generics return type cannot cast. [modified] Pin
Thomas Weller3-May-09 5:27
Thomas Weller3-May-09 5:27 
You can use a generic List instead of an untyped ArrayList, then copy the required references in the c'tor. (This assumes you are using .NET 3.5 - and of course your cIDList must be an IEnumerable, i.e. derived from any of the usual .NET collection classes).

Here's what it will look like:
public class cList<T>
{    
    private readonly List<T> ListItems = new List<T>();

    public cList(cIDList UseOwner)
    {
        if (UseOwner != null)
        { 
            ListItems.AddRange(UseOwner.OfType<T>());
        }
    }

    public T this[int Index]
    {       
        get
        {
            if ((Index >= 0) && (Index < ListItems.Count))
            {
                return ListItems[Index];
            }
          
            return null; // or default(T) or even better: throw an ArgumentOutOfRangeException...
       }
    }
}


Regards
Thomas

www.thomas-weller.de

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software.


modified on Sunday, May 3, 2009 11:35 AM

AnswerRe: Generics return type cannot cast. Pin
PIEBALDconsult3-May-09 5:31
mvePIEBALDconsult3-May-09 5:31 
Questionhelp Pin
hotthoughtguy2-May-09 23:09
hotthoughtguy2-May-09 23:09 
AnswerRe: help Pin
Eddy Vluggen2-May-09 23:49
professionalEddy Vluggen2-May-09 23:49 
GeneralRe: help Pin
hotthoughtguy3-May-09 1:07
hotthoughtguy3-May-09 1:07 
GeneralRe: help Pin
Eddy Vluggen3-May-09 1:51
professionalEddy Vluggen3-May-09 1:51 
GeneralRe: help Pin
Dave Kreskowiak3-May-09 4:19
mveDave Kreskowiak3-May-09 4:19 
QuestionI want to control some hardware by internet Pin
rashed.info2-May-09 21:35
rashed.info2-May-09 21:35 
AnswerRe: I want to control some hardware by internet Pin
Mycroft Holmes2-May-09 23:45
professionalMycroft Holmes2-May-09 23:45 
AnswerRe: I want to control some hardware by internet Pin
Eddy Vluggen2-May-09 23:46
professionalEddy Vluggen2-May-09 23:46 
QuestionUnable to find a version .......... [modified] Pin
Thaer Hamael2-May-09 20:39
Thaer Hamael2-May-09 20:39 
AnswerRe: Unable to find a version .......... Pin
Luc Pattyn3-May-09 0:25
sitebuilderLuc Pattyn3-May-09 0:25 
GeneralRe: Unable to find a version .......... Pin
Thaer Hamael3-May-09 1:08
Thaer Hamael3-May-09 1:08 
Questioninput equation from text box Pin
Mehrdad from iran2-May-09 19:08
Mehrdad from iran2-May-09 19:08 
AnswerRe: input equation from text box Pin
Dave Kreskowiak2-May-09 19:28
mveDave Kreskowiak2-May-09 19:28 
AnswerRe: input equation from text box Pin
PIEBALDconsult3-May-09 5:34
mvePIEBALDconsult3-May-09 5:34 
QuestionMSDN C# Related...? Pin
jas0n232-May-09 17:34
jas0n232-May-09 17:34 
AnswerRe: MSDN C# Related...? Pin
Dave Kreskowiak2-May-09 19:29
mveDave Kreskowiak2-May-09 19:29 

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.