user defined class libraries or Dlls


  • -1
    M

    Component--> A component is reusable piece of code and is in the form of DLL.

    When component is considered it can be reprocessed from every kind of application like in console application or windows application or web application or device application etc.

    To build component in .Net, we use class lending library templates.
    End user will never be interact with some application will relate to component or DLL.

    program for creating a Component / Assembly

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace CLibMaths
    {
    public class Arithmatic
    {
    public int Num1, Num2, Result;
    public int PNum1
    {

    set { Num1 = value; }
    get { return Num1; }
    }
    public int PNum2
    {
    set { Num2 = value; }
    }
    public int PResult
    {
    get { return Result; }
    }
    public int Add()
    {
    Result = Num1 + Num2;
    return Result;
    }
    public void Subtract()
    {
    Result = Num1 - Num2;
    }
    public void Multiply()
    {
    Result = Num1 * Num2;
    }
    public void Divide()
    {
    Result = Num1 / Num2;
    }
    }
    }

    IMPROVE a fresh class with name Cls Math Numbers
    Modify the availability of the class to public and compose following code

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace CLibMaths
    {
    public class ClsMathNumbers
    {
    public int Square(int x)
    {
    return x * x;
    }
    public int Cube(int x)
    {
    return x * Square(x);
    }
    public int Factorial(int x)
    {
    int R = 1;
    for (int i = 1; i <= x; i++)
    {
    R = R * i;
    }
    return R;
    }
    }
    }

    Build the solution will make a DLL. This dll is recognized as .net component
    to get the DLL go to the \bin\Debug file of the application, you discovery the CLibMaths.dll
    So, is there any one from software companies in Sharjah who can guide me in it!


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.