Click here to Skip to main content
15,915,770 members
Home / Discussions / C#
   

C#

 
GeneralRe: Rich Text Box and Fonts in c# Pin
Giorgi Dalakishvili12-Feb-08 9:50
mentorGiorgi Dalakishvili12-Feb-08 9:50 
Questionhow to add object to listview Pin
netJP12L12-Feb-08 8:03
netJP12L12-Feb-08 8:03 
AnswerRe: how to add object to listview Pin
Not Active12-Feb-08 8:27
mentorNot Active12-Feb-08 8:27 
GeneralRe: how to add object to listview Pin
netJP12L12-Feb-08 8:34
netJP12L12-Feb-08 8:34 
GeneralRe: how to add object to listview Pin
DaveyM6912-Feb-08 8:43
professionalDaveyM6912-Feb-08 8:43 
AnswerRe: how to add object to listview Pin
Ravenet12-Feb-08 14:38
Ravenet12-Feb-08 14:38 
GeneralRe: how to add object to listview Pin
Not Active12-Feb-08 16:48
mentorNot Active12-Feb-08 16:48 
QuestionNameOf method? Pin
Skippums12-Feb-08 7:40
Skippums12-Feb-08 7:40 
I have had to, on a number of occasions, do something like the following:
switch (a.GetType().FullName) {
    case "System.Int32":
        ...
        break;
    case "MyNamespace.SubNamespace.MyClass":
        ...
        break;
    ...
}
The problem is that if I change class name or the namespace of MyClass, the above breaks without generating a compile-time error. The way that I would like to perform the above is by using the type itself, and have "case typeof(MyClass):", but that DOES generate a compile-time error. I am wondering, then, if there is some method like typeof that gets a constant string representing the class name at compile time, so I could change the above code to...
switch (a.GetType().FullName) {
    case nameof(int):
        ...
        break;
    case nameof(MyClass):
        ...
        break;
    ...
}
This way, I would get compile-time errors instead of run-time errors if I changed the classname but didn't update the above code. Thanks,

Sounds like somebody's got a case of the Mondays

-Jeff

AnswerRe: NameOf method? Pin
Eslam Afifi12-Feb-08 8:12
Eslam Afifi12-Feb-08 8:12 
GeneralRe: NameOf method? Pin
Ravenet12-Feb-08 14:41
Ravenet12-Feb-08 14:41 
GeneralRe: NameOf method? Pin
Eslam Afifi13-Feb-08 2:32
Eslam Afifi13-Feb-08 2:32 
AnswerRe: NameOf method? Pin
TJoe12-Feb-08 8:13
TJoe12-Feb-08 8:13 
AnswerRe: NameOf method? Pin
Not Active12-Feb-08 8:14
mentorNot Active12-Feb-08 8:14 
AnswerRe: NameOf method? Pin
Luc Pattyn12-Feb-08 14:41
sitebuilderLuc Pattyn12-Feb-08 14:41 
AnswerRe: NameOf method? Pin
Roger Alsing12-Feb-08 22:00
Roger Alsing12-Feb-08 22:00 
GeneralAngle between two vectors Pin
Hami.Net12-Feb-08 7:00
Hami.Net12-Feb-08 7:00 
GeneralRe: Angle between two vectors Pin
Giorgi Dalakishvili12-Feb-08 7:17
mentorGiorgi Dalakishvili12-Feb-08 7:17 
GeneralRe: Angle between two vectors Pin
Eslam Afifi12-Feb-08 7:20
Eslam Afifi12-Feb-08 7:20 
AnswerRe: Angle between two vectors Pin
Spacix One12-Feb-08 7:20
Spacix One12-Feb-08 7:20 
QuestionHow to execute a gawk script in a c# aplication Pin
pcaeiro12-Feb-08 6:17
pcaeiro12-Feb-08 6:17 
AnswerRe: How to execute a gawk script in a c# aplication Pin
KaptinKrunch12-Feb-08 6:26
KaptinKrunch12-Feb-08 6:26 
Questionhow to access the data of MS word from c#.net 2005 Pin
shining12-Feb-08 5:56
shining12-Feb-08 5:56 
AnswerRe: how to access the data of MS word from c#.net 2005 Pin
Giorgi Dalakishvili12-Feb-08 6:24
mentorGiorgi Dalakishvili12-Feb-08 6:24 
AnswerRe: how to access the data of MS word from c#.net 2005 Pin
KaptinKrunch12-Feb-08 6:24
KaptinKrunch12-Feb-08 6:24 
GeneralRe: how to access the data of MS word from c#.net 2005 Pin
shining13-Feb-08 3:48
shining13-Feb-08 3:48 

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.