Monday, November 26, 2018
Wednesday, November 14, 2018
Difference between WriteLine() and Write() method
The main difference between
WriteLine()
and Write()
is that the Write()
method only prints the string provided to it, while the WriteLine()
method prints the string and moves to the start of next line as well.
Let's take at a look at the example below to understand the difference between these methods.
Example 1: How to use WriteLine() and Write() method?
When we run the program, the output will be
Thank you
Creating DLL and consuming it using C#
Description:
DLL Stand for (Dynamic Link Library).
How to create a DLL and consuming it because most of the reusable components are written in the form of a DLL.
Create DLL.
Step 1
First, create a project of type “Class Library” as shown here.
Then we are implementing a Fullname class library that is responsible for show fullname of user.
Step 3
Build this code and you will see that a DLL file has been created rather than an exe in the root directory of the application (path = C:\Users\Admin\Documents\visual studio 2017\Projects\LibraryForDLL\LibraryForTest\bin\Debug\netstandard1.4\ LibraryForTest.dll).
Consume the DLL
Step 1
Step 1
Now create another console based application(Any project) where we will utilize the class library functionality.In my case i am created new project in same Solution Explorer.
Step 2
Then you need to add the reference of the Fullname Class Library DLL file reference to access the declared class in the library DLL. (Right-click on the Reference then select Add reference then select the path of the DLL file.)
Step 3
Step 3
When you add the class library reference then you will see in the Solution Explorer that a new LibraryForTest is added as in the following,
Step 4
Now add the namespace of the class library file in the console application and create the instance of the class declared in the library as follows,
Subscribe to:
Posts (Atom)