Friday, June 25, 2021

Hash Table in C#

 The Hashtable is a non-generic collection and used to store the key/value pairs based on the hash code of the key. Key will be used to access the element in the collection.

Hashtable Characteristics

  • Comes under System.Collection namespace
  • Keys must be unique and cannot be null.
  • Values can be null or duplicate.
  • Values can be accessed by passing associated key in the indexer e.g. myHashtable[key]
  • Elements are stored as DictionaryEntry objects.
  • “ContainsKey” can be used to check the key in the hash table.
URL: https://dotnetfiddle.net/Tb8E69

Monday, September 3, 2018

Repeat character without loop in C#

 you can use string constructor that accepts a char and the number of times to repeat it.

Example:

public class Program
{
public static void Main()
{
string tabs = new String('X',  4);
Console.WriteLine(tabs);
}
}

OUTPUT:
XXXX

Sunday, March 25, 2018

Right and Left padding in C#

Padding adds the space or any character to the right or left side.

PadRight: This method add the characters in right side and left align
PadLeft: This method add the characters in left side and right align



Saturday, March 24, 2018

Readonly and Constant in C#

Constant: Constant fields are define at the time of declaration and once they are defined can't be changed.
NOTE:
  1. This can't be declared static.
  2. Local scope 
  3. This is implicitly static variable.
  4. This must to initialised
Readonly: Readonly can be initialised either at the time of declaration or within the constructor of the same class and change the value in the same class constructor.


Thursday, March 22, 2018

Dictionary in C#

  • Dictionary is generic collection and includes System.Collections.Generic namespace.
  • This is collection of Key and value pair and key must be a unique.
  • In the dictionary, you cannot be including duplicate key. 
  • In the dictionary, duplicate key given run time error.

NOTE:

  1. It returns error if we try to find a key which does not exist.
  2.  It is faster than a hash table because there is no boxing and unboxing.
  3. Dictionary is a generic type which means we can use it with any data type.

List<T> in C#

List
  • Lists are strongly typed generic collections.
  • They will store values of different or same datatype.
  • List size will increase or decrease dynamically.
  •  Its defined in the System.Collections.Generic namespace
      Add item in List :

Saturday, August 5, 2017

What is AngularJS?

  • AngularJS is an open source JavaScript MVC framework for web applications.
  • AngularJS extends Html behavior by creating custom tags or adding attributes in tags.
  • AngularJS can be used to create Single Page Applications (SPA).
  Some of the reasons why I would prefer AngularJS:
  • You can create a template and reuse it in application multiple times.
  • You can bind data to any element in two ways, where two-way actually means changing data will automatically change element and changing element will change the data.
  • You can directly call the code-behind code in your html.You can validate forms and input fields before submitting it without writing a single line of code.
  • Allows you to control complete DOM structure show/hide, changing everything with AngularJS properties.
  • AngularJS allows you to write basic flow end-to-end testing, unit-testing, UI mocks.
AngularJS provides all the features you need to build a CRUD application like data-binding, data validation, url routing, reusable HTML components and most importantly dependency injection.

Hash Table in C#

 The Hashtable is a non-generic collection and used to store the key/value pairs based on the hash code of the key. Key will be used to acce...