Samual Sam has Published 2492 Articles

How can I use SUBSTRING_INDEX() function to get the substring as output which is between two same delimiters in a string?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 11:40:33

183 Views

We need to use nested SUBSTRING_INDEX() function for getting the substring as output which is between two same delimiters in a string. For example, from the string ‘www.tutorialspoint.com’, we want the substring ‘tutorialspoint’, which is in between two same delimiters ‘.’ as output then SUBSTRING_INDEX() function can be used in ... Read More

How to define custom methods in C#?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 11:38:03

832 Views

To define a custom method in C#, use the following syntax − (Parameter List) { Method Body }The following are the various elements of a method −Access Specifier − This determines the visibility of a variable or a method from another class.Return type − A method may return a ... Read More

Why we do not have global variables in C#?

Samual Sam

Samual Sam

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

151 Views

C# does not have global variables and the scope resolution operator used in C++ for global variables is related to namespaces. It is called global namespace alias.If you have a type that shares an identifier in a different namespace, then to identify them using the scope resolution operator.For example, to ... Read More

Why do we use comma operator in C#?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 11:19:46

625 Views

Comma operator in C# can be used as a separator in method argument list. You can also use it is an operator in a for statement.The following is an example showing using a comma operator in a for statement for initialization −for (int i = begin, j = 1; i

Working with DateTime in C#

Samual Sam

Samual Sam

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

501 Views

The DateTime class in C# is used to represent date and time in C#.The following are some of the properties of DateTime in C# −Sr.NoProperty & Description1DateGets the Date component2DayGets the day of the month3HourGets the hour of the month4MinuteGets the minute of the date5MonthGets the month of the dateLet ... Read More

What is the method for sorting a list in C#?

Samual Sam

Samual Sam

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

74 Views

The sort a list in C#, use the Sort() method.Let us first create a list −List myList = new List();Now add elements −myList.Add("Audi"); myList.Add("BMW"); myList.Add("Chevrolet"); myList.Add("Hyundai");Use the Sort() method to sort the list −myList.Sort();The following is an example showing how to sort a list in C# −Example Live Demousing System; using ... Read More

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

Samual Sam

Samual Sam

Updated on 20-Jun-2020 11:04:13

92 Views

Use the Count property to find the count of elements of the Queue class. Set elements like the following declaration −Queue q = new Queue(); q.Enqueue(1); q.Enqueue(2); q.Enqueue(3); q.Enqueue(4);Then use the Count property to count the elements −q.CountThe following is an example showing how to work with Count property ... Read More

How is a new object created in C#?

Samual Sam

Samual Sam

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

73 Views

Like any other object-oriented language, C# also has object and classes. Objects are real-world entities and instance of a class. Access the members of the class using an object.To access the class members, you need to use the dot (.) operator after the object name. The dot operator links the ... Read More

C# Program to Implement Stack with Push and Pop operations

Samual Sam

Samual Sam

Updated on 20-Jun-2020 10:59:24

533 Views

Set stack with Push operation to add elements to the Stack −Stack st = new Stack(); st.Push('A'); st.Push('M'); st.Push('G'); st.Push('W');To Pop elements from the stack, use Pop() method −st.Pop();st.Pop();The following is an example to implement a stack with Push and Pop operations −Example Live Demousing System; using System.Collections; namespace ... Read More

Command Line arguments in C#

Samual Sam

Samual Sam

Updated on 20-Jun-2020 10:51:53

3K+ Views

If you want to pass arguments by command line, then use command line arguments in C# −When we create a program in c#, static void main is used and we can see the arguments in it .class HelloWorld {    static void Main(string[] args) {       /* my ... Read More

Advertisements