Click here to Skip to main content
15,501,747 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to get key board entries on windows explorer ? Pin
Dave Kreskowiak31-May-16 4:43
mveDave Kreskowiak31-May-16 4:43 
Questionstore MAC address at installation time Pin
Member 1234275230-May-16 20:45
MemberMember 1234275230-May-16 20:45 
AnswerRe: store MAC address at installation time Pin
OriginalGriff30-May-16 22:04
mveOriginalGriff30-May-16 22:04 
QuestionChange Winform Webbrowser url externally Pin
avisotorisher30-May-16 18:28
Memberavisotorisher30-May-16 18:28 
AnswerRe: Change Winform Webbrowser url externally Pin
Mycroft Holmes30-May-16 19:55
professionalMycroft Holmes30-May-16 19:55 
GeneralRe: Change Winform Webbrowser url externally Pin
avisotorisher30-May-16 20:35
Memberavisotorisher30-May-16 20:35 
Questionstrategy for run-time de-referencing of generic parameter ? Pin
BillWoodruff30-May-16 1:19
mveBillWoodruff30-May-16 1:19 
AnswerRe: strategy for run-time de-referencing of generic parameter ? Pin
Alan N30-May-16 2:50
MemberAlan N30-May-16 2: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.
GeneralRe: strategy for run-time de-referencing of generic parameter ? Pin
BillWoodruff30-May-16 3:12
mveBillWoodruff30-May-16 3:12 
QuestionRe: strategy for run-time de-referencing of generic parameter ? Pin
Richard Deeming1-Jun-16 3:15
mveRichard Deeming1-Jun-16 3:15 
QuestionHow to copy columns data from one excel file to another excel file using C#. Pin
Member 1194327029-May-16 23:00
MemberMember 1194327029-May-16 23:00 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
Richard MacCutchan29-May-16 23:19
mveRichard MacCutchan29-May-16 23:19 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
OriginalGriff29-May-16 23:27
mveOriginalGriff29-May-16 23:27 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
Gerry Schmitz30-May-16 6:43
mveGerry Schmitz30-May-16 6:43 
QuestionHow can i retry read current line at text file? Pin
Member 1243103929-May-16 20:01
MemberMember 1243103929-May-16 20:01 
AnswerRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 20:22
mveOriginalGriff29-May-16 20:22 
GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 21:16
MemberMember 1243103929-May-16 21:16 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 21:53
mveOriginalGriff29-May-16 21:53 
GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 23:10
MemberMember 1243103929-May-16 23:10 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 23:12
mveOriginalGriff29-May-16 23:12 
GeneralRe: How can i retry read current line at text file? Pin
Matt T Heffron31-May-16 9:52
professionalMatt T Heffron31-May-16 9:52 
AnswerRe: How can i retry read current line at text file? Pin
koolprasad200329-May-16 20:30
professionalkoolprasad200329-May-16 20:30 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 21:03
mveOriginalGriff29-May-16 21:03 
GeneralRe: How can i retry read current line at text file? Pin
koolprasad200329-May-16 21:08
professionalkoolprasad200329-May-16 21:08 
GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 21:28
MemberMember 1243103929-May-16 21:28 

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.