Click here to Skip to main content
15,891,431 members
Home / Discussions / C#
   

C#

 
GeneralRe: Back and Forward button for MDI Parent Pin
Rashad Hameed31-May-16 11:14
Rashad Hameed31-May-16 11:14 
GeneralRe: Back and Forward button for MDI Parent Pin
OriginalGriff31-May-16 11:37
mveOriginalGriff31-May-16 11:37 
AnswerRe: Back and Forward button for MDI Parent Pin
Brisingr Aerowing31-May-16 3:00
professionalBrisingr Aerowing31-May-16 3:00 
AnswerRe: Back and Forward button for MDI Parent Pin
BillWoodruff31-May-16 3:36
professionalBillWoodruff31-May-16 3:36 
QuestionVisual Studio 2005 Web Application Problem Pin
Zeyad Jalil31-May-16 0:07
professionalZeyad Jalil31-May-16 0:07 
AnswerRe: Visual Studio 2005 Web Application Problem Pin
Dave Kreskowiak31-May-16 3:45
mveDave Kreskowiak31-May-16 3:45 
QuestionScrape a controls which doesn't have any handle in windows application Pin
Member 1101883830-May-16 23:55
Member 1101883830-May-16 23:55 
AnswerRe: Scrape a controls which doesn't have any handle in windows application Pin
OriginalGriff30-May-16 23:59
mveOriginalGriff30-May-16 23:59 
GeneralRe: Scrape a controls which doesn't have any handle in windows application Pin
BillWoodruff31-May-16 3:38
professionalBillWoodruff31-May-16 3:38 
AnswerRe: Scrape a controls which doesn't have any handle in windows application Pin
Gerry Schmitz31-May-16 5:21
mveGerry Schmitz31-May-16 5:21 
AnswerRe: Scrape a controls which doesn't have any handle in windows application Pin
Eddy Vluggen31-May-16 5:32
professionalEddy Vluggen31-May-16 5:32 
AnswerRe: Scrape a controls which doesn't have any handle in windows application Pin
Bernhard Hiller1-Jun-16 0:03
Bernhard Hiller1-Jun-16 0:03 
QuestionConnection String using by ini file or TextFile Pin
Mostafa_Hosseini30-May-16 22:18
Mostafa_Hosseini30-May-16 22:18 
AnswerRe: Connection String using by ini file or TextFile Pin
OriginalGriff30-May-16 22:42
mveOriginalGriff30-May-16 22:42 
GeneralRe: Connection String using by ini file or TextFile Pin
Mostafa_Hosseini31-May-16 4:34
Mostafa_Hosseini31-May-16 4:34 
GeneralRe: Connection String using by ini file or TextFile Pin
OriginalGriff31-May-16 4:46
mveOriginalGriff31-May-16 4:46 
QuestionHow to get key board entries on windows explorer ? Pin
srikrishnathanthri30-May-16 20:34
srikrishnathanthri30-May-16 20:34 
AnswerRe: How to get key board entries on windows explorer ? Pin
Dave Kreskowiak31-May-16 3:43
mveDave Kreskowiak31-May-16 3:43 
Questionstore MAC address at installation time Pin
Member 1234275230-May-16 19:45
Member 1234275230-May-16 19:45 
AnswerRe: store MAC address at installation time Pin
OriginalGriff30-May-16 21:04
mveOriginalGriff30-May-16 21:04 
QuestionChange Winform Webbrowser url externally Pin
avisotorisher30-May-16 17:28
avisotorisher30-May-16 17:28 
AnswerRe: Change Winform Webbrowser url externally Pin
Mycroft Holmes30-May-16 18:55
professionalMycroft Holmes30-May-16 18:55 
GeneralRe: Change Winform Webbrowser url externally Pin
avisotorisher30-May-16 19:35
avisotorisher30-May-16 19:35 
Questionstrategy for run-time de-referencing of generic parameter ? Pin
BillWoodruff30-May-16 0:19
professionalBillWoodruff30-May-16 0:19 
AnswerRe: strategy for run-time de-referencing of generic parameter ? Pin
Alan N30-May-16 1:50
Alan N30-May-16 1:50 
I'm not sure I understand the reason for the complexity. The final code fragment shows the use of the 'as' operator to perform a cast, implying that the type is known at compile time. If in fact all types are known then why use reflection at all, just go with is or as.

C#
public void CastingCouch() {
  List<ISomeInterface> someInstances = new List<ISomeInterface>();
  someInstances.Add(new SomeClass<int>(100, 200));
  someInstances.Add(new SomeClass<string>(200, "whoop de doo"));
  someInstances.Add(new SomeClass<DateTime>(300, DateTime.Now));

  foreach (ISomeInterface reference in someInstances) {
    Console.Write("{0}  ", reference.GetType());

    if (reference is SomeClass<string>) {
      Console.WriteLine("String");
    } else if (reference is SomeClass<int>) {
      Console.WriteLine("Int");
    } else {
      Console.WriteLine("Don't know");
    }
  }
}

Alan.

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.