What is a Copy Constructor in C#

Samual Sam
Updated on 21-Jun-2020 12:39:00

4K+ Views

Copy Constructor creates an object by copying variables from another object.Let us see an example −Exampleusing System; namespace Demo {    class Student {       private string name;       private int rank;       public Student(Student s) {          name = s.name;          rank = s.rank;       }       public Student(string name, int rank) {          this.name = name;          this.rank = rank;       }       public string Display {     ... Read More

Structure of a Client-Server System

Ricky Barnes
Updated on 21-Jun-2020 12:37:22

6K+ Views

In client server computing, the clients requests a resource and the server provides that resource. A server may serve multiple clients at the same time while a client is in contact with only one server.The different structures for two tier and three tier are given as follows −Two - Tier Client/Server StructureThe two tier architecture primarily has two parts, a client tier and a server tier.The client tier sends a request to the server tier and the server tier responds with the desired information.An example of a two tier client/server structure is a web server. It returns the required web ... Read More

What are Types in C#

Ankith Reddy
Updated on 21-Jun-2020 12:36:45

213 Views

The types in C# include the following −Value TypesValue type variables can be assigned a value directly. They are derived from the class System.ValueType.The value types directly contain data. Some examples are int, char, and float, which stores numbers, alphabets, and floating point numbers, respectively. When you declare an int type, the system allocates memory to store the value.Reference TypesThe reference types do not contain the actual data stored in a variable, but they contain a reference to the variables.Pointer TypesPointer type variables store the memory address of another type. Pointers in C# have the same capabilities as the pointers ... Read More

Single Processor Systems

Alex Onsman
Updated on 21-Jun-2020 12:36:31

19K+ Views

A single processor system contains only one processor. So only one process can be executed at a time and then the process is selected from the ready queue. Most general purpose computers contain the single processor systems as they are commonly in use.A single processor system can be further described using the diagram below −As in the above diagram, there are multiple applications that need to be executed. However, the system contains a single processor and only one process can be executed at a time.Differences Between Single Processor and Multiprocessor SystemsThere are many differences between single processor and multiprocessor systems.Some ... Read More

Difference between HashTable and HashMap in Java

Rishi Raj
Updated on 21-Jun-2020 12:35:45

3K+ Views

Following are the notable differences between HashTable and HashMap classes in Java. HashTableHashMapSynchronizedHashTable is synchronized.HashMap is not synchronized.Thread SafeHashTable is thread safe.HashMap is not thread safe.Null objectsHashTable does not allows null keys or null values.HashMap allows one null key and multiple null values.PerformanceHashTable is faster.HashMap is slower than HashTable.Since Java Version1.21.5Exampleimport java.util.HashMap; import java.util.Hashtable; import java.util.Map; public class Tester {    public static void main(String args[]) {       Map map = new HashMap();       map.put("1", "One");       map.put("2", "Two");       map.put("3", "Three");       map.put("5", "Five");       ... Read More

Difference between TreeMap, HashMap and LinkedHashMap in Java

Paul Richard
Updated on 21-Jun-2020 12:35:10

13K+ Views

HashMap, TreeMap and LinkedHashMap all implements java.util.Map interface and following are their characteristics.HashMapHashMap has complexity of O(1) for insertion and lookup.HashMap allows one null key and multiple null values.HashMap does not maintain any order.TreeMapTreeMap has complexity of O(logN) for insertion and lookup.TreeMap does not allow null key but allow multiple null values.TreeMap maintains order. It stores keys in sorted and ascending order.LinkedHashMapLinkedHashMap has complexity of O(1) for insertion and lookup.LinkedHashMap allows one null key and multiple null values.LinkedHashMap maintains order in which key-value pairs are inserted.Exampleimport java.util.HashMap; import java.util.Hashtable; import java.util.LinkedHashMap; import java.util.Map; import java.util.TreeMap; public class Tester { ... Read More

Escape Characters in C#

Arjun Thakur
Updated on 21-Jun-2020 12:34:14

1K+ Views

The following is the list of escape characters in C# −Escape characterDescriptionPattern\aMatches a bell character, \u0007.\a\bIn a character class, matches a backspace, \u0008.[\b]{3, }\tMatches a tab, \u0009.(\w+)\t\rMatches a carriage return, \u000D. (\r is not equivalent to the newline character, .)\r(\w+)\vMatches a vertical tab, \u000B.[\v]{2, }\fMatches a form feed, \u000C.[\f]{2, }Matches a new line, \u000A.\r(\w+)\eMatches an escape, \u001B.\ennUses octal representation to specify a character (nnnconsists of up to three digits).\w\040\w\x nnUses hexadecimal representation to specify a character (nn consists of exactly two digits).\w\x20\w\c X\c xMatches the ASCII control character that is specified by X or x, where X or x is ... Read More

Math Class Methods in C#

karthikeya Boyini
Updated on 21-Jun-2020 12:33:38

608 Views

The System.Math class in C# provides methods are properties to perform mathematical operations, trigonometric, logarithmic calculations, etc.Some of its methods include −Sr.NoMethod & Description1Abs(Decimal)Returns the absolute value of a Decimal number.2Abs(Double)Returns the absolute value of a double-precision floating-point number.3Abs(Int16)Returns the absolute value of a 16-bit signed integer.4Abs(Int32)Returns the absolute value of a 32-bit signed integer.5Abs(Int64)Returns the absolute value of a 64-bit signed integer.6Abs(SByte)Returns the absolute value of an 8-bit signed integer.7Abs(Single)Returns the absolute value of a single-precision floating-point number.8Acos(Double)Returns the angle whose cosine is the specified number.9Asin(Double)Returns the angle whose sine is the specified number.10Atan(Double)Returns the angle whose tangent is ... Read More

Log Functions in C#

Samual Sam
Updated on 21-Jun-2020 12:31:31

2K+ Views

With C#, you can easily work with Logarithms. It has the following methods for Log as well as Log base 10.Sr.NoMethod & Description1Log(Double)Returns the natural (base e) logarithm of a specified number.2LogDouble)(Double,Returns the logarithm of a specified number in a specified base.3Log10(Double)Returns the base 10 logarithm of a specified number.Let us see an example to work with Log functions in C# −Exampleusing System; class Demo {    static void Main() {       double val1 = Math.Log(1);       Console.WriteLine(val1);       double val2 = Math.Log10(1000);       Console.WriteLine(val2);    } }

Rules for Naming Classes in C#

karthikeya Boyini
Updated on 21-Jun-2020 12:28:25

523 Views

A class definition starts with the keyword class followed by the class name; and the class body enclosed by a pair of curly braces.The following is the syntax − class class_name {    // member variables     variable1;     variable2;    ...     variableN;    // member methods     method1(parameter_list) {       // method body    }     method2(parameter_list) {    // method body    }    ...     methodN(parameter_list) {       // method body    } }The following are the conventions ... Read More

Advertisements