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

C#

 
AnswerRe: Method for erase textboxes by clicking a button Pin
osamashatnawe29-May-14 0:27
osamashatnawe29-May-14 0:27 
QuestionHow to find interfaces in code programmatically Pin
Frygreen28-May-14 6:31
Frygreen28-May-14 6:31 
AnswerRe: How to find interfaces in code programmatically Pin
Richard MacCutchan28-May-14 6:40
mveRichard MacCutchan28-May-14 6:40 
AnswerRe: How to find interfaces in code programmatically Pin
Kornfeld Eliyahu Peter28-May-14 6:41
professionalKornfeld Eliyahu Peter28-May-14 6:41 
AnswerRe: How to find interfaces in code programmatically Pin
Eddy Vluggen28-May-14 7:21
professionalEddy Vluggen28-May-14 7:21 
AnswerRe: How to find interfaces in code programmatically Pin
jschell28-May-14 8:46
jschell28-May-14 8:46 
AnswerRe: How to find interfaces in code programmatically Pin
BobJanova29-May-14 1:20
BobJanova29-May-14 1:20 
QuestionLoading and unloading assemblies using reflection Pin
nitin_ion28-May-14 1:38
nitin_ion28-May-14 1:38 
<pre lang="c#">
string fileToLoad = @"C:\Users\nitin.jain\Documents\visual studio 2012\Projects\ConsoleApplication1\ClassLibrary1\bin\Debug\ClassLibrary1.dll";
            string migrationStepsDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ClassLibrary1.dll");
            AppDomainSetup appDomainSetup = new AppDomainSetup() { PrivateBinPath = AppDomain.CurrentDomain.BaseDirectory, ShadowCopyFiles="true" };
            Evidence evidence = AppDomain.CurrentDomain.Evidence;

            AppDomain appDomain = AppDomain.CreateDomain("ClassLibrary1", evidence, appDomainSetup);

            //WORKING
            Assembly assembly = Assembly.LoadFile(fileToLoad);

            //This part works well
            Type type = assembly.GetType("ClassLibrary1.Class1");
            object foo = Activator.CreateInstance(type);
            MethodInfo methodInfo = type.GetMethod("CheckAdress");
            methodInfo.Invoke(foo, new object[] { "navdeep" });
            AppDomain.Unload(appDomain);
            Console.WriteLine("App domain unloaded");
            Console.ReadLine();


This code is in console application and it works fine in the sense that it loads and unload the assembly in the domain.
But when my console is running and i try to delete the dll it says that dll is opened in console application.
So it is locked by it. How can i make sure that after unloading it, also unlocks the file.
SuggestionRe: Loading and unloading assemblies using reflection Pin
Richard MacCutchan28-May-14 2:46
mveRichard MacCutchan28-May-14 2:46 
AnswerRe: Loading and unloading assemblies using reflection Pin
Rob Philpott28-May-14 4:52
Rob Philpott28-May-14 4:52 
QuestionInserting missing attributes in XML / app.config file Pin
Flockston8627-May-14 22:59
Flockston8627-May-14 22:59 
AnswerRe: Inserting missing attributes in XML / app.config file Pin
Dave Kreskowiak28-May-14 2:29
mveDave Kreskowiak28-May-14 2:29 
AnswerRe: Inserting missing attributes in XML / app.config file Pin
Flockston863-Jun-14 1:20
Flockston863-Jun-14 1:20 
GeneralRe: Inserting missing attributes in XML / app.config file Pin
Dave Kreskowiak3-Jun-14 2:14
mveDave Kreskowiak3-Jun-14 2:14 
GeneralRe: Inserting missing attributes in XML / app.config file Pin
Flockston863-Jun-14 2:25
Flockston863-Jun-14 2:25 
GeneralRe: Inserting missing attributes in XML / app.config file Pin
Dave Kreskowiak3-Jun-14 4:42
mveDave Kreskowiak3-Jun-14 4:42 
QuestionVisual Studio Output to Run as Admin always Pin
Subin Mavunkal27-May-14 22:57
Subin Mavunkal27-May-14 22:57 
AnswerRe: Visual Studio Output to Run as Admin always Pin
Richard MacCutchan28-May-14 0:53
mveRichard MacCutchan28-May-14 0:53 
Questioncustom file properties Pin
jeffingeorge27-May-14 22:38
jeffingeorge27-May-14 22:38 
AnswerRe: custom file properties Pin
Chris Quinn27-May-14 22:48
Chris Quinn27-May-14 22:48 
AnswerRe: custom file properties Pin
Eddy Vluggen28-May-14 0:28
professionalEddy Vluggen28-May-14 0:28 
QuestionFile opertions Pin
jeffingeorge27-May-14 22:36
jeffingeorge27-May-14 22:36 
AnswerRe: File opertions Pin
Karen Mitchelle27-May-14 22:51
professionalKaren Mitchelle27-May-14 22:51 
AnswerRe: File opertions Pin
Eddy Vluggen28-May-14 0:28
professionalEddy Vluggen28-May-14 0:28 
Questionconvert string to system.linq.iqueryable in C# Pin
joji joseph27-May-14 22:08
joji joseph27-May-14 22:08 

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.