Question

In: Computer Science

Create a class library (.dll) in a particular namespace (using csc or VS2017) to define one...

  1. Create a class library (.dll) in a particular namespace (using csc or VS2017) to define one or more classes, each contains fields, methods, constructors, and/or properties, including r/w properties, auto-implemented and/or expression-bodied properties.

Solutions

Expert Solution

Below is the class library code.

using System;

namespace MyClassLibrary
{
    public class MyLibraryClass
    {
        //Fields
        private string name;
        private int age;

        private int _rollNumber;

        // Auto-implemented properties
        public string Division { get; set; }

        //Read Write Property. It has both get and set accessor hence considered as read/write properties.
        public int RollNumber
        {
            get
            {
                return _rollNumber;
            }
            set
            {
                _rollNumber = value;
            }
        }

        //Read only property
        public string TestMessage
        {
            get
            {
                return "Hello!";
            }
        }

        //Default constructor
        public MyLibraryClass()
        {

        }

        //Parameteric constructor
        public MyLibraryClass(int rollNumber, string division)
        {
            this.RollNumber = rollNumber;
            this.Division = division;
        }

        public MyLibraryClass(string stateName, string country)
        {
            this.StateName = stateName;
            this.CountryName = country;
        }

        //Method with zero parameter.
        public int getSquareOfTwo()
        {
            int square = 2 * 2;
            return square;
        }

        //Method with two parameters
        public int getMultiplication(int a, int b)
        {
            int multiplication = a * b;
            return multiplication;
        }

        //expression-body properties
        public string StateName { get; set; }
        public string CountryName { get; set; }

        public string CountryState => $"{CountryName} {StateName}";
    }
}

Follow below step to create class library.

Open visual studio
Create new project
Under Visual C#, Create class library.
Give Name as per your choice


Related Solutions

using java Define a class Library based on the following specifications: a. A library can have...
using java Define a class Library based on the following specifications: a. A library can have multiple books. Decide on the best possible data structure to store books. b. A library has a name. c. A library has an address. Define a 2-argument constructor for the Library class. Decide on the arguments needed for this constructor. e. Define a method that can add new books to the library. f. Define a method that allows a book to be borrowed (checked...
#ifndef CONTAINER_H #define CONTAINER_H using namespace std; class container { public: // CONSTRUCTOR container(); ~container(); container(const...
#ifndef CONTAINER_H #define CONTAINER_H using namespace std; class container { public: // CONSTRUCTOR container(); ~container(); container(const container& c); container& operator=(const container& c) // MEMBER FUNCTIONS bool lookup(const int& target); void remove(const int& target); void add(const int& target); private: struct node{ int key; node *next; }; node* head; node* tail; }; #endif For a linked list based implementation of a container class shown above, implement the constructor, copy constructor, destructor and copy assignment functions.
Patient.cs : //namespace using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //application namespace namespace...
Patient.cs : //namespace using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //application namespace namespace ConsoleApp_Patient { class Patient //C# class { //private fields for patientid, lastname,firstname, age, and email. private int patientid; private string lastname; private string firstname; private int age; private string email; //public data items for each of these private fields with get and //set methods public int PatientID //Public field for patientid { get { return patientid; } set { patientid = value;//set patinetid }...
Patient.cs : //namespace using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //application namespace namespace...
Patient.cs : //namespace using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //application namespace namespace ConsoleApp_Patient { class Patient //C# class { //private fields for patientid, lastname,firstname, age, and email. private int patientid; private string lastname; private string firstname; private int age; private string email; //public data items for each of these private fields with get and //set methods public int PatientID //Public field for patientid { get { return patientid; } set { patientid = value;//set patinetid }...
JAVA program Create a class called Array Outside of the class, import the Scanner library Outside...
JAVA program Create a class called Array Outside of the class, import the Scanner library Outside of main declare two static final variables and integer for number of days in the week and a double for the revenue per pizza (which is $8.50). Create a method called main Inside main: Declare an integer array that can hold the number of pizzas purchased each day for one week. Declare two additional variables one to hold the total sum of pizzas sold...
C++ please #include <iostream> using namespace std; /** * defining class circle */ class Circle {...
C++ please #include <iostream> using namespace std; /** * defining class circle */ class Circle { //defining public variables public: double pi; double radius; public: //default constructor to initialise variables Circle(){ pi = 3.14159; radius = 0; } Circle(double r){ pi = 3.14159; radius = r; } // defining getter and setters void setRadius(double r){ radius = r; } double getRadius(){ return radius; } // method to get Area double getArea(){ return pi*radius*radius; } }; //main method int main() {...
1. (10 pts) Define the nodes in the LinkedList. Create the LinkedList using the ListNode class....
1. (10 pts) Define the nodes in the LinkedList. Create the LinkedList using the ListNode class. Create a method to find a node with given value in a LinkedList. Return the value is this value exists in the LinkedList. Return null if not exists. Use these two examples to test your method. Example 1: Input: 1 -> 2 -> 3, and target value = 3 Output: 3 Example 2: Input: 1 -> 2 -> 3, and target value = 4...
using System; using System.Data.SqlTypes; using System.Globalization; using System.Reflection.Metadata.Ecma335; using System.Runtime.Intrinsics.X86; using System.Security.Cryptography.X509Certificates; namespace ConsoleApp4 { class...
using System; using System.Data.SqlTypes; using System.Globalization; using System.Reflection.Metadata.Ecma335; using System.Runtime.Intrinsics.X86; using System.Security.Cryptography.X509Certificates; namespace ConsoleApp4 { class Program { static void Main(string[] args) { AO function = new AO(1000, 3); function.Find(); } } class AO { public a(long _max , long _least) { max = _max; least = _least; numm = new long[1000]; } public long max; public long least; public long[] numm; public long Find() { long per =0; long sum = 0; for(int i=1; i<=max; i++) {    for(int...
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Assignment07 { class Dog { public void...
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Assignment07 { class Dog { public void bark(string dogsName) { int barking =5; while(barking < 5)    Console.WriteLine(dogsName + " is barking"); } public void run(string dogsName) { int running = 10; while(running > 10) Console.WriteLine(dogsName + " is running"); } } class Program { static void Main(string[] args) { Dog fido = new Dog(); fido.bark("Fido"); fido.run("Fido"); Console.Write("Hit any key to close"); Console.ReadKey(true); } } } need to create 2 while...
Using ONE of the following themes to create a class and demonstrate the idea. Use this...
Using ONE of the following themes to create a class and demonstrate the idea. Use this to create a solution (two ADTs and a driver program) to demonstrate the following concepts. Create a one page summary to describe where you are using each of these concepts. Themes:(PICK ONE) a house has a door a semester has a holiday break a cell phone has a shatterproof case a chair has a cushion Concepts to include: composition separating interface from implementation an...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT