Monday, July 23, 2018

Can I run a Class Library project in an interactive session?

A Class Library project creates a class file, a .dll. You cannot run it directly because there is no executable, lacks a Main() program.

However, you can run it in an interactive session by following the next mentioned steps:

Right click the Class Library Project and choose Initialize Interactive from the drop-down list:



ClassLibFrameInteractive_0

The C# Interactive session begins with loading the project context related files as shown.


ClassLibFrameInteractive_00

Now that Joinstring namespace creates a class, Create an instance of the class as cls1.

cls1 can now access the Add method in Class1 which takes two arguments.
Supply them and print the result as shown.


ClassLibFrameInteractive
-------------
Here is the Joinstring project folder and Class1.cs



ClassLibFrameInteractive_000


ClassLibFrameInteractive_001

No comments: