Tools, FAQ, Tutorials:
"MyLibApp.cs" - Call VC# Class from Library
How to call a function from a VC# class provided in a library?
✍: FYIcenter.com
If you want to call a function from a VC# class provided in a library,
you can follow this tutorial:
1. Reference the shared function with the class name prefix:
MyLib.PrintHello();
2. See the following full source code example, MyLibApp.cs:
// MyLibApp.cs
// Copyright (c) FYIcenter.com
using fyi;
namespace fyi {
public class MyLibApp {
static void Main(string[] args) {
MyLib.PrintHello();
}
}
}
3. Compile the code with the "csc /reference" command:
\fyicenter>csc /reference:MyLib.dll MyLibApp.cs Microsoft (R) Visual C# Compiler version 2.2.0.61624 Copyright (C) Microsoft Corporation. All rights reserved. >dir MyLibApp.* 09:23 AM 203 MyLibApp.cs 09:23 AM 3,584 MyLibApp.exe
4. Run the executable code:
C:\fyicenter>MyLibApp.exe Hello world! - From MyLib
⇐ "MyLib.cs" - VC# Class and Library
2017-08-06, ∼3234🔥, 0💬
Popular Posts:
How to install .NET Framework in Visual Studio Community 2017? I have the Visual Studio Installer in...
How To Truncate an Array in PHP? If you want to remove a chunk of values from an array, you can use ...
How to read Atom validation errors at w3.org? If your Atom feed has errors, the Atom validator at w3...
What is EPUB 3.0 Metadata "dcterms:modified" property? EPUB 3.0 Metadata "dcterms:modified" is a req...
How to access Request body from "context.Request.Body" object in Azure API Policy? Request body is t...