Click here to Skip to main content
14,689,513 members
Home » Discussions » C#
   

C#

 
AnswerRe: Design an elegant solution for choosing a class whose method gets called Pin
Gerry Schmitz26-Oct-20 15:58
mveGerry Schmitz26-Oct-20 15:58 
Questionan apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff25-Oct-20 23:18
mveBillWoodruff25-Oct-20 23:18 
AnswerRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox25-Oct-20 23:58
professionalpkfox25-Oct-20 23:58 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 0:15
mveBillWoodruff26-Oct-20 0:15 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox26-Oct-20 0:59
professionalpkfox26-Oct-20 0:59 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 3:13
mveBillWoodruff26-Oct-20 3:13 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox26-Oct-20 3:48
professionalpkfox26-Oct-20 3:48 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
F-ES Sitecore26-Oct-20 2:15
mveF-ES Sitecore26-Oct-20 2:15 
If you call

SetCache(x);


and "x" is type string then it compiles

SetCache<string>(x);


if "x" is an int then it compiles

SetCache<int>(x);


whatever type "x" is it assumes the type between the angled brackets is that type. The only time you absolutely have to supply the type is when the IDE can't work out itself what the type is. For example if you have

T GetCache<T>(string key)


then the IDE can't workout what "T" should be from the params

GetCache("username");


In the above code there is no way to work out what GetCache returns so you have to explicitly say;

GetCache<string>("username");

GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 3:09
mveBillWoodruff26-Oct-20 3:09 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
Richard MacCutchan26-Oct-20 3:38
mveRichard MacCutchan26-Oct-20 3:38 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
F-ES Sitecore26-Oct-20 3:55
mveF-ES Sitecore26-Oct-20 3:55 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
Richard Deeming26-Oct-20 3:34
mveRichard Deeming26-Oct-20 3:34 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 4:50
mveBillWoodruff26-Oct-20 4:50 
AnswerRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff27-Oct-20 0:59
mveBillWoodruff27-Oct-20 0:59 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
harold aptroot27-Oct-20 1:45
Memberharold aptroot27-Oct-20 1:45 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff27-Oct-20 6:46
mveBillWoodruff27-Oct-20 6:46 
QuestionHow to allow numbers and special characters in a textBox in C#? Pin
Alex Dunlop25-Oct-20 6:51
MemberAlex Dunlop25-Oct-20 6:51 
AnswerRe: How to allow numbers and special characters in a textBox in C#? Pin
Richard MacCutchan25-Oct-20 7:19
mveRichard MacCutchan25-Oct-20 7:19 
GeneralRe: How to allow numbers and special characters in a textBox in C#? Pin
Alex Dunlop25-Oct-20 8:00
MemberAlex Dunlop25-Oct-20 8:00 
GeneralRe: How to allow numbers and special characters in a textBox in C#? Pin
Richard MacCutchan25-Oct-20 8:13
mveRichard MacCutchan25-Oct-20 8:13 
AnswerRe: How to allow numbers and special characters in a textBox in C#? Pin
BillWoodruff25-Oct-20 22:58
mveBillWoodruff25-Oct-20 22:58 
QuestionHi guys, currently making a guessing game and need some help with my code.. Pin
Member 1497438624-Oct-20 13:53
MemberMember 1497438624-Oct-20 13:53 
AnswerRe: Hi guys, currently making a guessing game and need some help with my code.. Pin
BillWoodruff24-Oct-20 16:04
mveBillWoodruff24-Oct-20 16:04 
GeneralMessage Closed Pin
22-Oct-20 22:58
MemberOsman Bur22-Oct-20 22:58 
GeneralRe: Kayan Yazı Pin
CHill6022-Oct-20 23:09
mveCHill6022-Oct-20 23:09 

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.