Click here to Skip to main content
15,885,947 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: strategy for run-time de-referencing of generic parameter ? Pin
BillWoodruff30-May-16 2:12
professionalBillWoodruff30-May-16 2:12 
QuestionRe: strategy for run-time de-referencing of generic parameter ? Pin
Richard Deeming1-Jun-16 2:15
mveRichard Deeming1-Jun-16 2:15 
If you don't have a list of "known" types, how are you planning to use the "dereferenced" type? There's nothing you can cast it to other than object, which doesn't really give you anything interesting to play with.

Also, you existing code in #5 won't work if someone implements your interface in a different class:
C#
class SomeOtherClass : ISomeInterface { ... }
class YetAnotherClass<TKey, TValue> : ISomeInterface { ... }

someInstances.Add(new SomeOtherClass(42));
someInstances.Add(new YetAnotherClass<NotTheTypeYoureLookingFor, TheDroids>());

You'd need more checks to ensure it's the expected type:
C#
Type referenceType = reference.GetType();
if (referenceType.IsGenericType && referenceType.GetGenericTypeDefinition == typeof(SomeClass<>))
{
    // It's a SomeClass<T>:
    Type t = referenceType.GetGenericArguments()[0];
    ...
}
else
{
    // It's something else
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionHow to copy columns data from one excel file to another excel file using C#. Pin
Member 1194327029-May-16 22:00
Member 1194327029-May-16 22:00 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
Richard MacCutchan29-May-16 22:19
mveRichard MacCutchan29-May-16 22:19 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
OriginalGriff29-May-16 22:27
mveOriginalGriff29-May-16 22:27 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
Gerry Schmitz30-May-16 5:43
mveGerry Schmitz30-May-16 5:43 
QuestionHow can i retry read current line at text file? Pin
Member 1243103929-May-16 19:01
Member 1243103929-May-16 19:01 
AnswerRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 19:22
mveOriginalGriff29-May-16 19:22 
GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 20:16
Member 1243103929-May-16 20:16 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 20:53
mveOriginalGriff29-May-16 20:53 
GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 22:10
Member 1243103929-May-16 22:10 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 22:12
mveOriginalGriff29-May-16 22:12 
GeneralRe: How can i retry read current line at text file? Pin
Matt T Heffron31-May-16 8:52
professionalMatt T Heffron31-May-16 8:52 
AnswerRe: How can i retry read current line at text file? Pin
koolprasad200329-May-16 19:30
professionalkoolprasad200329-May-16 19:30 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 20:03
mveOriginalGriff29-May-16 20:03 
GeneralRe: How can i retry read current line at text file? Pin
koolprasad200329-May-16 20:08
professionalkoolprasad200329-May-16 20:08 
GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 20:28
Member 1243103929-May-16 20:28 
GeneralRe: How can i retry read current line at text file? Pin
koolprasad200329-May-16 22:56
professionalkoolprasad200329-May-16 22:56 
GeneralRe: How can i retry read current line at text file? Pin
Eddy Vluggen30-May-16 0:25
professionalEddy Vluggen30-May-16 0:25 

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.