Found 26504 Articles for Server Side Programming

C# Program to Print the Length of the Hashtable

Shilpa Nadkarni
Updated on 22-Dec-2022 18:08:50

751 Views

Hashtable collection in C# is a collection of elements wherein each element consist of key-value pair. The key of the element is unique and non-null while the value of the element can be duplicated or even null. The key-and-value pairs are organized based on the hash code of the key. The key is used to access the elements in the collection. In C#, the class named Hashtable represents the hashtable collection. This class provides various constructors to construct/create the hashtable object. The Hashtable class also provides various methods and properties using which we can manipulate the hashtable collection. Let’s ... Read More

C# Program to Merge Two Hashtable Collections

Shilpa Nadkarni
Updated on 22-Dec-2022 18:03:32

654 Views

The hashtable collection in C# stores key-value pairs. Each element or item in this collection is a key-value pair i.e. this collection is a double-element collection. The Key is unique, non-null, and used to access the elements in the hashtable. The hashtable collection is immutable and cannot have duplicate elements. This means combination of key-value should be unique. However, the values can be null or duplicated. The .Net Framework provides a HashTable class to implement the hashtable collection and contains the required functionality to implement a hashtable without any additional coding. Each element within the hashtable collection is a DictionaryEntry ... Read More

C# Program to Get Key based on Value in Hashtable Collection

Shilpa Nadkarni
Updated on 22-Dec-2022 17:29:42

1K+ Views

A hash table is a collection in C# that holds items identified as key-value pairs. So unlike other data structures like the stack, queue, or ArrayList in C# that store a single value, hashtable in C# stores 2 values. These 2 values i.e. key-value pair form an element of the hash table. In a hashtable, the keys are unique and should not be null. The values in the hashtable can be null and also duplicated. In C#, the System.collections interface provides a class “Hashtable” which is used to represent the hashtable collection. This class provides various constructors to create a ... Read More

C# Program to Check if Value exists in Hashtable

Shilpa Nadkarni
Updated on 22-Dec-2022 17:22:55

2K+ Views

The hashtable is an organized collection of key-value pairs wherein the keys are arranged as per the hash code of the key calculated using the hash function. While the keys should be non-null and unique in a hashtable, the values can be null and duplicate. The elements in the hashtable are accessed using the keys. In C#, the class “Hashtable” represents the hashtable collection. This class provides various properties and methods using which we can perform operations and access data in the hashtable. In this article, we will see how we can determine if a particular value is present ... Read More

Golang Program to get the numerator from a rational number

Akhil Sharma
Updated on 22-Dec-2022 18:31:40

317 Views

In this article, we will discuss how to get a numerator from a rational number. Syntax func NewRat(a, b int64) *Rat func (x *Rat) Num() *Int NewRat() function takes two integer numbers as input arguments and returns a rational number in the form of a/b. here a is the numerator and b is the denominator of a rational number. Num() function in the Go language returns the numerator of a rational number as the result in integer format. Method-1 Go language program to get the numerator from a rational number. Algorithm Step 1 − Import the fmt and ... Read More

Golang Program to get the denominator from a rational number

Akhil Sharma
Updated on 23-Dec-2022 10:26:31

291 Views

In this article, we will discuss how to get the denominator from a rational number. Rational numbers − In mathematics, rational numbers are defined as numbers that can be expressed in the form of a/b where a and b are integer values. For example- 1/3, 5/8 etc. Note that the denominator of a rational number can never be zero. Syntax func NewRat(a, b int64) *Rat func (x *Rat) Denom() *Int NewRat() function takes two integer numbers as input arguments and returns a rational number in the form of a/b. here a is the numerator and b is the denominator ... Read More

Golang Program to Create an Interface

Akhil Sharma
Updated on 22-Dec-2022 18:24:13

1K+ Views

In this article, we are going to learn about how to create an interface using golang programming INTERFACE − In the go language, an interface is a custom type that is used to specify one or more method signatures. An interface is abstract i.e. we cannot create an instance of the interface but we can create a variable to the interface type and assign this variable to the struct or class that has methods needed by the interface. Syntax type interface_name interface { // method signatures } Example 1 To define an interface first we need ... Read More

Golang Program to Create Abstract Class

Akhil Sharma
Updated on 22-Dec-2022 18:21:48

3K+ Views

In this article, we are going to learn about how to create an Abstract class using Golang Programming Abstract Class − A restricted class is called an abstract class which cannot be used to create an object from it to access an abstract class, it must be inherited from another class. The Go interface lacks fields and forbids the definition of methods inside of it. Any type must implement every interface method in order to belong to that interface type. There are situations in which having a method's default implementation and default fields in GO is helpful. Let's first grasp ... Read More

Golang Program to Create a Class and Object

Akhil Sharma
Updated on 22-Dec-2022 18:20:37

11K+ Views

In this article we are going to learn how to create class and object. Structs − Go language does not have classes. To create an object in the go programming language we can specify structs and store key-value pairs in it. A struct is a user-defined data type that is used to store data together. The values so stored may have the same or different data type. Syntax The syntax to define a structure is as follows − type name_of_struct struct { name_1 type_1 name_2 type_2 name_3 type_3 ... Read More

Golang Program to Convert Linked list to an Array

Akhil Sharma
Updated on 22-Dec-2022 18:19:36

715 Views

In this article we are going to learn about how to convert linked list to an array using golang program. Linked List − Elements in linked lists are typically not stored in close proximity to one another and their storage structures are less rigid, they must be stored with additional tags that refer to the subsequent element. A linked list is a structure that is created dynamically it has two elements in it one is to store the value and the other is to store the address of the next structure. Array − In arrays elements are stored in contiguous ... Read More

Advertisements