Click here to Skip to main content
15,897,704 members
Home / Discussions / C#
   

C#

 
AnswerRe: SQL Connection in Visual Studio Pin
Matt Slay24-Apr-20 16:28
Matt Slay24-Apr-20 16:28 
AnswerRe: SQL Connection in Visual Studio Pin
OriginalGriff24-Apr-20 20:09
mveOriginalGriff24-Apr-20 20:09 
AnswerRe: SQL Connection in Visual Studio Pin
Gerry Schmitz25-Apr-20 11:46
mveGerry Schmitz25-Apr-20 11:46 
Questioncasting from interface instance back to generic instance ? Pin
BillWoodruff24-Apr-20 1:11
professionalBillWoodruff24-Apr-20 1:11 
GeneralRe: casting from interface instance back to generic instance ? Pin
harold aptroot24-Apr-20 1:29
harold aptroot24-Apr-20 1:29 
GeneralRe: casting from interface instance back to generic instance ? Pin
BillWoodruff24-Apr-20 2:41
professionalBillWoodruff24-Apr-20 2:41 
GeneralRe: casting from interface instance back to generic instance ? Pin
Richard Deeming24-Apr-20 3:26
mveRichard Deeming24-Apr-20 3:26 
GeneralRe: casting from interface instance back to generic instance ? Pin
BillWoodruff24-Apr-20 4:52
professionalBillWoodruff24-Apr-20 4:52 
Thanks, Richard, if you look at the code I posted, you will see that as the generic instance is created, the generic Type is injected into the instance.
public IBeing AddBeing<T>(string name, T value) where T : class
{
    Being<T> newbeing = new Being<T>(name, value);
    newbeing.BType = typeof(T);
    Beings.Add(newbeing);
    return newbeing;
}
when the generic Type is added to the interface instance collection, it is "downcast" to the interface, but the Type variable is there, and accessible from the interface instance at run time.

Your code example has no relevance to the issue here.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

GeneralRe: casting from interface instance back to generic instance ? Pin
Richard Deeming24-Apr-20 4:59
mveRichard Deeming24-Apr-20 4:59 
AnswerRe: casting from interface instance back to generic instance ? Pin
jschell26-Apr-20 9:59
jschell26-Apr-20 9:59 
AnswerMessage Closed Pin
23-Apr-20 2:41
Corrie Lang23-Apr-20 2:41 
GeneralRe: During Pin
OriginalGriff23-Apr-20 3:15
mveOriginalGriff23-Apr-20 3:15 
QuestionRefreshing data on a parent form at child close Pin
Uranium-23521-Apr-20 20:24
Uranium-23521-Apr-20 20:24 
AnswerRe: Refreshing data on a parent form at child close Pin
OriginalGriff21-Apr-20 21:44
mveOriginalGriff21-Apr-20 21:44 
GeneralRe: Refreshing data on a parent form at child close Pin
Uranium-23521-Apr-20 22:48
Uranium-23521-Apr-20 22:48 
GeneralRe: Refreshing data on a parent form at child close Pin
OriginalGriff21-Apr-20 23:04
mveOriginalGriff21-Apr-20 23:04 
GeneralRe: Refreshing data on a parent form at child close Pin
Uranium-23522-Apr-20 23:27
Uranium-23522-Apr-20 23:27 
GeneralRe: Refreshing data on a parent form at child close Pin
OriginalGriff23-Apr-20 0:09
mveOriginalGriff23-Apr-20 0:09 
GeneralRe: Refreshing data on a parent form at child close Pin
Uranium-23523-Apr-20 10:46
Uranium-23523-Apr-20 10:46 
GeneralRe: Refreshing data on a parent form at child close Pin
OriginalGriff23-Apr-20 11:06
mveOriginalGriff23-Apr-20 11:06 
GeneralRe: Refreshing data on a parent form at child close Pin
Uranium-23524-Apr-20 17:53
Uranium-23524-Apr-20 17:53 
GeneralRe: Refreshing data on a parent form at child close Pin
OriginalGriff24-Apr-20 20:08
mveOriginalGriff24-Apr-20 20:08 
GeneralRe: Refreshing data on a parent form at child close Pin
Uranium-23525-Apr-20 19:42
Uranium-23525-Apr-20 19:42 
AnswerRe: Refreshing data on a parent form at child close Pin
#realJSOP22-Apr-20 7:15
professional#realJSOP22-Apr-20 7:15 
QuestionMaintain the Runing balance in Datagridview Pin
Mukhtar Ashiq21-Apr-20 9:04
Mukhtar Ashiq21-Apr-20 9:04 

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.