Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Karthikeya Boyini has Published 2192 Articles
karthikeya Boyini
490 Views
Firstly, add elements −IDictionary d = new Dictionary(); d.Add(1, 97); d.Add(2, 89); d.Add(3, 77); d.Add(4, 88);Now, get the keys −List myList = new List(d.Keys);To iterate −foreach (int k in myList) { Console.WriteLine("{0}, {1}", k, d[k]); }The following is an example −Example Live Demousing System; using System.Collections.Generic; public class Demo ... Read More
karthikeya Boyini
406 Views
Firstly, use the DirectoryInfo object −//creating a DirectoryInfo object DirectoryInfo mydir = new DirectoryInfo(@"d:\amit");Now, use the GetFiles() method to get all the files −FileInfo [] f = mydir.GetFiles();To get the list of files in a directory, try to run the following code −Exampleusing System; using System.IO; namespace Demo { ... Read More
karthikeya Boyini
2K+ Views
Check for the following conditions −For odd and even, check for the remainder when the number is divided by 2 −// checking for odd/ even if(n % 2 == 0) { Console.WriteLine("Even"); } else { Console.WriteLine("Odd"); }For positive, negative and checking whether a number is 0 or not ... Read More
karthikeya Boyini
3K+ Views
By executing SELECT @@TX_ISOLATION command we can check the current MySQL transaction isolation level.Examplemysql> SELECT @@TX_ISOLATION; +-----------------+ | @@TX_ISOLATION | +-----------------+ | REPEATABLE-READ | +-----------------+ 1 row in set (0.00 sec)
karthikeya Boyini
728 Views
The flow control in try, catch, and finally can be understood using the following example. Here, we are dividing two numbers −Example Live Demousing System; namespace ErrorHandlingApplication { class DivNumbers { int result; DivNumbers() { result = 0; ... Read More
karthikeya Boyini
581 Views
To print “Hello World” in C#, use the Console.WriteLine.Let us see a basic C# program to display a text −Example Live Demousing System; using System.Collections.Generic; using System.Text; namespace Program { class MyApplication { static void Main(string[] args) { Console.WriteLine("Hello World"); ... Read More
karthikeya Boyini
444 Views
Declare an array and initialize −int[] arr = new int[] { 87, 23, 65, 29, 67 };To sort, use the Sort() method and CompareTo() to compare and display in decreasing order −Array.Sort < int > (arr, new Comparison < int > ((val1, val2) => val2.CompareTo(val1)));Let ... Read More
karthikeya Boyini
16K+ Views
Use the DateTime.TryParseExact method in C# for Date Format validation.They method converts the specified string representation of a date and time to its DateTime equivalent. It checks whether the entered date format is correct or not.Example Live Demousing System; using System.Globalization; namespace Demo { class Program { ... Read More
karthikeya Boyini
2K+ Views
Set two arrays that you wish to merge −int[] arr1 = new int[5] { 5, 15, 25, 30, 47 }; int[] arr2 = new int[5] { 55, 60, 76, 83, 95 };Now take a third array that would merge both ... Read More
karthikeya Boyini
223 Views
Boxing is implicit and unboxing is explicit. Unboxing is the explicit conversion of the reference type created by boxing, back to a value type.Let us see an example of variable and object in C# −// int int x = 30; // Boxing object obj = x; // Un ... Read More