Chandu yadav has Published 1163 Articles

What does the @ prefix do on string literals in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 12:50:07

540 Views

The @prefix states hat you don't need to escape special characters in the string following to the symbol.The following statement@"D:ew"is equal to:"D:ew"The @ prefix is also used if you want to have large strings and want it to be displayed across multiple lines. The following is an example showing multi-line ... Read More

What are contextual keywords in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 11:50:16

531 Views

In C#, some identifiers have special meaning in context of code, such as get and set are called contextual keywords.The following is the table showing contextual keywords −Contextual Keywordsaddaliasascendingdescendingdynamicfromgetglobalgroupintojoinletorderbypartial (type)partial(method)removeselectset

How to assign multiple values to same variable in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 11:21:17

3K+ Views

To set multiple values to same variable, use arrays in C#. Let’s say instead of taking 5 variables, set these 5 variables using arrays in a single variable.The following is an example to set three values to a single variable with a string array −string[] arr = new string[3];Let us ... Read More

Why is the Main() method use in C# static?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 11:17:28

3K+ Views

The Main method states what the class does when executed and instantiates other objects and variables.A main method is static since it is available to run when the C# program starts. It is the entry point of the program and runs without even creating an instance of the class.The following ... Read More

What is the Count property of SortedList class in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 11:02:51

79 Views

Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          SortedList s = new SortedList();          s.Add("S1", "Electronics");          s.Add("S2", "Clothing");          s.Add("S3", "Applicances");   ... Read More

How do you empty an array in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 10:52:35

17K+ Views

To empty an array in C#, use the Array Clear() method: The Array.Clear method in C# clears i.e.zeros out all elements.In the below example, we have first considered an array with three elements −int[] arr = new int[] {88, 45, 76};Now we have used the Array.Clear method to zero out ... Read More

What are the different commands used in MySQL?

Chandu yadav

Chandu yadav

Updated on 19-Jun-2020 13:52:18

4K+ Views

SQL language is divided into four types of primary language statements: DML, DDL, DCL and TCL. Using these statements, we can define the structure of a database by creating and altering database objects and we can manipulate data in a table through updates or deletions. We also can control which ... Read More

How to find Square root of complex numbers in Python?

Chandu yadav

Chandu yadav

Updated on 18-Jun-2020 06:40:16

442 Views

You can find the Square root of complex numbers in Python using the cmath library. The cmath library in python is a library for dealing with complex numbers. You can use it as follows to find the square root −Examplefrom cmath import sqrta = 0.2 + 0.5j print(sqrt(a))OutputThis will give ... Read More

Reservoir Sampling

Chandu yadav

Chandu yadav

Updated on 17-Jun-2020 09:51:21

874 Views

The Reservoir sampling is a randomized algorithm. In this algorithm, k items are chosen from a list with n different items.We can solve it by creating an array as a reservoir of size k. Then randomly pick one element from the main list and placed that item in the reservoir ... Read More

Possible walks from a source to a destination with exactly k edges

Chandu yadav

Chandu yadav

Updated on 17-Jun-2020 09:36:20

270 Views

A directed graph is given. Another two vertices u and v are also given, u is the starting vertex, and v is the ending vertex. Our task is to find a number of walks from vertex u to v with exactly k edges. The value of k is also provided ... Read More

Advertisements