Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to use the GoF in project? Pin
BobJanova4-Mar-14 6:06
BobJanova4-Mar-14 6:06 
QuestionDll References and Dependencies Pin
MarkB1233-Mar-14 7:58
MarkB1233-Mar-14 7:58 
AnswerRe: Dll References and Dependencies Pin
Richard Andrew x643-Mar-14 8:38
professionalRichard Andrew x643-Mar-14 8:38 
GeneralRe: Dll References and Dependencies Pin
MarkB1233-Mar-14 8:57
MarkB1233-Mar-14 8:57 
AnswerRe: Dll References and Dependencies Pin
Pete O'Hanlon3-Mar-14 10:09
mvePete O'Hanlon3-Mar-14 10:09 
GeneralRe: Dll References and Dependencies Pin
Richard Andrew x643-Mar-14 13:16
professionalRichard Andrew x643-Mar-14 13:16 
AnswerRe: Dll References and Dependencies Pin
Matt T Heffron3-Mar-14 13:59
professionalMatt T Heffron3-Mar-14 13:59 
AnswerRe: Dll References and Dependencies Pin
BobJanova4-Mar-14 5:27
BobJanova4-Mar-14 5:27 
You can actually catch the exception that gets thrown when a class can't be loaded. The trick is that the class must not be used in your Main method, because entering a method which uses a class the point that the class binder tries to load it, and you can't catch it.

So you can do something like
static void Main() {
 try { EntryPoint(); }
 catch(FileNotFoundException) { 
  // ...
  // e.g. put up message that a dependency is missing
 }
}

static void EntryPoint() {
 var x = new DependencyClass(); // declared in other assembly
}


The 'correct' way to do it is to handle Application.AssemblyResolve but what I've described here can be useful if all you want to do is tell the user they need to install something which is missing in a more graceful way.
GeneralRe: Dll References and Dependencies Pin
MarkB1234-Mar-14 5:34
MarkB1234-Mar-14 5:34 
Questiondatatype in DataGridview Pin
naylynn3-Mar-14 4:29
naylynn3-Mar-14 4:29 
AnswerRe: datatype in DataGridview Pin
Raj Mouli7-Mar-14 18:51
Raj Mouli7-Mar-14 18:51 
QuestionInvalid Argument in For Loop Pin
computerpublic2-Mar-14 8:03
computerpublic2-Mar-14 8:03 
AnswerRe: Invalid Argument in For Loop Pin
Pete O'Hanlon2-Mar-14 8:06
mvePete O'Hanlon2-Mar-14 8:06 
GeneralRe: Invalid Argument in For Loop Pin
computerpublic2-Mar-14 8:09
computerpublic2-Mar-14 8:09 
GeneralRe: Invalid Argument in For Loop Pin
computerpublic2-Mar-14 8:12
computerpublic2-Mar-14 8:12 
AnswerRe: Invalid Argument in For Loop Pin
PIEBALDconsult2-Mar-14 8:27
mvePIEBALDconsult2-Mar-14 8:27 
GeneralRe: Invalid Argument in For Loop Pin
computerpublic2-Mar-14 8:33
computerpublic2-Mar-14 8:33 
QuestionRe: Invalid Argument in For Loop Pin
Eddy Vluggen2-Mar-14 9:04
professionalEddy Vluggen2-Mar-14 9:04 
AnswerMessage Closed Pin
2-Mar-14 9:17
computerpublic2-Mar-14 9:17 
GeneralRe: Invalid Argument in For Loop Pin
Richard MacCutchan2-Mar-14 22:43
mveRichard MacCutchan2-Mar-14 22:43 
AnswerRe: Invalid Argument in For Loop Pin
noone24072-Mar-14 17:46
noone24072-Mar-14 17:46 
GeneralRe: Invalid Argument in For Loop Pin
computerpublic2-Mar-14 18:00
computerpublic2-Mar-14 18:00 
GeneralRe: Invalid Argument in For Loop Pin
noone24072-Mar-14 18:32
noone24072-Mar-14 18:32 
AnswerRe: Invalid Argument in For Loop Pin
OriginalGriff2-Mar-14 22:49
mveOriginalGriff2-Mar-14 22:49 
GeneralRe: Invalid Argument in For Loop Pin
computerpublic3-Mar-14 3:52
computerpublic3-Mar-14 3:52 

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.