Click here to Skip to main content
15,918,676 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to stop exposing multiple endpoint at client side in WCF Pin
Tridip Bhattacharjee24-Sep-14 21:35
professionalTridip Bhattacharjee24-Sep-14 21:35 
GeneralRe: How to stop exposing multiple endpoint at client side in WCF Pin
Dominic Burford25-Sep-14 1:24
professionalDominic Burford25-Sep-14 1:24 
GeneralRe: How to stop exposing multiple endpoint at client side in WCF Pin
Tridip Bhattacharjee25-Sep-14 2:39
professionalTridip Bhattacharjee25-Sep-14 2:39 
GeneralRe: How to stop exposing multiple endpoint at client side in WCF Pin
Dominic Burford25-Sep-14 3:57
professionalDominic Burford25-Sep-14 3:57 
Questionerror: "Not a legal OleAut"when importing Excel2007 into SQL Pin
Member 245846723-Sep-14 21:51
Member 245846723-Sep-14 21:51 
AnswerRe: error: "Not a legal OleAut"when importing Excel2007 into SQL Pin
Bernhard Hiller24-Sep-14 20:56
Bernhard Hiller24-Sep-14 20:56 
QuestionRegarding a basic question about Serialization Pin
Tridip Bhattacharjee23-Sep-14 21:26
professionalTridip Bhattacharjee23-Sep-14 21:26 
AnswerRe: Regarding a basic question about Serialization PinPopular
Eddy Vluggen23-Sep-14 21:50
professionalEddy Vluggen23-Sep-14 21:50 
AnswerRe: Regarding a basic question about Serialization Pin
George Jonsson24-Sep-14 18:14
professionalGeorge Jonsson24-Sep-14 18:14 
AnswerRe: Regarding a basic question about Serialization Pin
Sibeesh KV24-Sep-14 18:43
professionalSibeesh KV24-Sep-14 18:43 
Questionusing Peachtree API in C# Pin
Jassim Rahma23-Sep-14 11:08
Jassim Rahma23-Sep-14 11:08 
AnswerRe: using Peachtree API in C# Pin
jschell23-Sep-14 11:58
jschell23-Sep-14 11:58 
QuestionIterate over a Collection-Type for its Values using Reflection Pin
Agent__00723-Sep-14 1:48
professionalAgent__00723-Sep-14 1:48 
AnswerRe: Iterate over a Collection-Type for its Values using Reflection Pin
BillWoodruff23-Sep-14 2:24
professionalBillWoodruff23-Sep-14 2:24 
GeneralRe: Iterate over a Collection-Type for its Values using Reflection Pin
Agent__00723-Sep-14 2:37
professionalAgent__00723-Sep-14 2:37 
GeneralRe: Iterate over a Collection-Type for its Values using Reflection Pin
BillWoodruff23-Sep-14 4:09
professionalBillWoodruff23-Sep-14 4:09 
GeneralRe: Iterate over a Collection-Type for its Values using Reflection Pin
Agent__00723-Sep-14 18:41
professionalAgent__00723-Sep-14 18:41 
GeneralRe: Iterate over a Collection-Type for its Values using Reflection Pin
BillWoodruff23-Sep-14 20:29
professionalBillWoodruff23-Sep-14 20:29 
SuggestionRe: Iterate over a Collection-Type for its Values using Reflection Pin
George Jonsson23-Sep-14 2:38
professionalGeorge Jonsson23-Sep-14 2:38 
GeneralRe: Iterate over a Collection-Type for its Values using Reflection Pin
Agent__00723-Sep-14 18:24
professionalAgent__00723-Sep-14 18:24 
AnswerRe: Iterate over a Collection-Type for its Values using Reflection Pin
Simon_Whale23-Sep-14 4:17
Simon_Whale23-Sep-14 4:17 
Hopefully this may be of some use.

C#
List<int>; d = new List<int>() { 1, 2, 3, 4, 5, 6 };
if (typeof(IList).IsAssignableFrom(d.GetType()) == true && d.GetType().IsGenericType == true)
{
    IList x = d;

    //Get the type in the list
    Type t = x.GetType().GetGenericArguments()[0];

    foreach (object item in x)
    {
        switch (t.Name)
        {
            case "Int32":
                int r = (int)item;
                break;
            default:
                break;
        }
    }
}


My only part I wasn't sure of was casting the object back to type that was in the list, So I used a simple switch statement to do the hard work for me. Also apologies for the crap variable naming too.
Every day, thousands of innocent plants are killed by vegetarians.

Help end the violence EAT BACON

GeneralRe: Iterate over a Collection-Type for its Values using Reflection Pin
Agent__00723-Sep-14 18:33
professionalAgent__00723-Sep-14 18:33 
AnswerRe: Iterate over a Collection-Type for its Values using Reflection Pin
Eddy Vluggen23-Sep-14 7:17
professionalEddy Vluggen23-Sep-14 7:17 
GeneralRe: Iterate over a Collection-Type for its Values using Reflection Pin
Agent__00723-Sep-14 18:11
professionalAgent__00723-Sep-14 18:11 
QuestionTCP/IP : Socket programming Pin
Rajeeva B J23-Sep-14 1:10
Rajeeva B J23-Sep-14 1:10 

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.