Chandu yadav has Published 1091 Articles

What is the C# Equivalent of SQL Server DataTypes?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 17:18:20

17K+ Views

The following table displays the C# equivalent of SQL Server datatypes −SQL Server data typeEquivalent C# data typevarbinaryByte[]binaryByte[]imageNonevarcharNonecharNonenvarcharString, Char[]ncharString, Char[]textNonentextNonerowversionByte[]bitBooleantinyintBytesmallintInt16intInt32bigintInt64smallmoneyDecimalmoneyDecimalnumericDecimaldecimalDecimalrealSinglefloatDoublesmalldatetimeDateTimedatetimeDateTimetableNonecursorNonetimestampNonexmlNone

What is the AddRange method in C# lists?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 17:13:12

8K+ Views

AddRange method in lists adds an entire collection of elements. Let us see an example −Firstly, set a list in C# and add elements −List list = new List(); list.Add(100); list.Add(200); list.Add(300); list.Add(400);Now set an array of elements to be added to the list −// array of 4 elements int[] ... Read More

What are reference data types in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 17:06:41

2K+ Views

The reference data type in C# does not have the actual data stored in a variable, but they contain a reference to the variables.In C#, the following are the built-in reference types −Object TypeThe Object Type is the ultimate base class for all data types in C# Common Type System ... Read More

What are mixed arrays in C#?

Chandu yadav

Chandu yadav

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

1K+ Views

Mixed arrays are a combination of multi-dimension arrays and jagged arrays.Note − The mixed arrays type is obsolete now since .NET 4.0 update removed it.Let us see how you can declare a mixed array −var x = new object[] {89, 45, "jacob", 9.8}We can also set them as −var x ... Read More

Hashtable vs. Dictionary in C#

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:47:09

1K+ Views

HashtableA hash table is used when you need to access elements by using key, and you can identify a useful key value. Each item in the hash table has a key/value pair. The key is used to access the items in the collection.The members in a Hashtable are thread safe. ... Read More

Ways to print escape characters in C#

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:46:28

1K+ Views

The following are the escape characters in C# and the display column suggests how to use and print them in C# −Escape CharacterDescriptionPatternDisplay\aMatches a bell character, \u0007.\a"\u0007" in "Warning!" + '\u0007'\bIn a character class, matches a backspace, \u0008.[\b]{3, }"\b\b\b\b" in "\b\b\b\b"\tMatches a tab, \u0009.(\w+)\t"Name\t", "Addr\t" in "Name\tAddr\t"\rMatches a carriage return, ... Read More

What are key-based I/O collections in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:38:04

211 Views

The key-based I/O Collections in C# is what we call a SortedList −SortedListThe SortedList class represents a collection of key-and-value pairs that are sorted by the keys and are accessible by key and by index. This is how both of them gets added in a SortedList −s.Add("Sub1", "Physics"); s.Add("Sub2", "Chemistry"); ... Read More

What are overloaded indexers in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:35:18

783 Views

An indexer in C# allows an object to be indexed such as an array. When an indexer for a class is defined, this class behaves similar to a virtual array. You can then access the instance of this class using the array access operator ([ ]).Indexers can be overloaded. Indexers ... Read More

What are I/O classes in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:22:55

916 Views

The System.IO namespace has various classes useful for performing various operations with files, such as creating and deleting files, reading from or writing to a file, closing a file etc.The following are the I/O classes in C# −Sr.No.I/O Class & Description1BinaryReaderReads primitive data from a binary stream.2BinaryWriterWrites primitive data in ... Read More

Integer literals vs Floating point literals in C#

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:16:35

413 Views

Integer LiteralsAn integer literal can be a decimal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, and there is no prefix id for decimal. Here are some of the examples of integer literals −10 // int 18u // unsigned intLet’s use the above ... Read More

Advertisements