Create generic method in csharp to swap values of different data types

The following example creates a generic method that can be called to perform the same work on different types of arguments. Generics are specified with angle brackets that include the type name (usually T). using System; namespace GenericMethods { class Program { static void Main(string[] args) { int aInt = 13; int bInt = 26; […]
Continue reading…

Enjoyed this post? Share it!

 
 

C# data types and their VB equivalents

C# data type VB data type bool Boolean byte Byte char Char decimal Decimal double Double float Single int Integer long Long object Object sbyte System.SByte short Short string String System.Currency Currency System.DateTime Date uint System.UInt32 ulong System.UInt64 ushort System.UInt16 <class_name> <class_name> <delegate_name> <delegate_name> <interface_name> <interface_name> <structure_name> <structure_name>
Continue reading…

Enjoyed this post? Share it!

 
 

Primitive data types in java

There are eight primitive types of data in java: byte, short, int, long, char, float, double, and boolean. They are broadly classified as: Integers – byte, short, int, and long Floating-point – float and double. Characters Boolean Byte The smallest integer type in java and has a range from -128 to 127. Byte is used […]
Continue reading…

Enjoyed this post? Share it!

 
 

XML-RPC Variable type detection

XML-RPC is clever enough to automatically detect the data type of the parameters passed to it in the xmlrpc_encode_request function. Example code: <?php $intvar = "77"; settype($intvar, "integer"); $req = xmlrpc_encode_request("NameOfRemoteCall’, $intvar); echo $req; ?> Output: <?xml version="1.0" encoding="iso-8859-1"?> <methodCall> <methodName>NameOfRemoteCall</methodName> <params> <param> <value><int>77</int></value> </param> </params> </methodCall>
Continue reading…

Enjoyed this post? Share it!

 
 

Types of collections in C#

Collections are classes used for storing, looking up related objects and allows developers to iterate over those objects. The System.Collections namespace in the .NET Framework supports many different types of collections. A few of the most common ones are mentioned below. ArrayList : A simple resizeable, index-based collection of objects. SortedList : A sorted collection […]
Continue reading…

Enjoyed this post? Share it!

 
 

Date and Time data types in MySql

MySQL supports the following date and time data types: DATE – A date in the range of ‘1000-01-01’ and ‘9999-12-31’. Default DATE format is “YYYY-MM-DD”. DATETIME – A date with the time of day in the range of ‘1000-01-01 00:00:00’ and ‘9999-12-31 23:59:59’. Default DATETIME format is “YYYY-MM-DD HH:MM:SS”. TIMESTAMP – A timestamp. The range […]
Continue reading…

Enjoyed this post? Share it!

 
 

Types of string data in MySql

MySQL supports the following string data types: CHAR(n) same as CHARACTER(n) – Fixed width and ” ” padded characters strings. Default character set is ASCII. NCHAR(n) same as NATIONAL CHARACTER(n) – Fixed width and ” ” padded character strings with UTF8 character set. VARCHAR(n) same as CHARACTER VARYING(n) – Variable width character strings. Default character […]
Continue reading…

Enjoyed this post? Share it!

 
 

Groups of data types in MySql

MySQL support 3 groups of data types namely string, numeric and date/time. Listed below are the data types. String Data Types – CHAR, NCHAR, VARCHAR, NVARCHAR, BINARY, VARBINARY, TINYBLOB, TINYTEXT, BLOB, TEXT, MEDIUMBLOB, MEDIUMTEXT, LONGBLOB, LONGTEXT, ENUM, SET Numeric Data Types – BIT, TINYINT, BOOLEAN, SMALLINT, MEDIUMINT, INTEGER, BIGINT, FLOAT, DOUBLE, REAL, DECIMAL. Date and […]
Continue reading…

Enjoyed this post? Share it!

 
 

Type Conversions in C# (CSharp)

CSharp supports two kinds of type conversions: implicit conversions and explicit conversions. Implicit conversions are conversions in which one type can directly and safely be converted to another type. Generally, small range type converts to large range type. Converting from an int type to a long type is an example and in this conversion, there […]
Continue reading…

Enjoyed this post? Share it!

 
 

Data Types in C# (CSharp) : Part 3 – Reference Types

A reference type is a reference to an instance type. The reference types in csharp are class, array, interface, delegate, and event. A null value is assigned to a reference type by default. A type assigned to a null value means the absence of an instance of that type and will give a compile time […]
Continue reading…

Enjoyed this post? Share it!

 
 

Data Types in C# (CSharp) : Part 2 – Value Types

Value types reference the actual data and are declared by using their default constructors. The default constructor of these types returns a zero- initialized instance of the variable. The value types can further be categorized into many types as shown in the following sections. Simple Types Simple types include basic data types such as int, […]
Continue reading…

Enjoyed this post? Share it!

 
 

Data Types in C# (CSharp) : Part 1 – Introduction

C# supports value types and reference types. Value types include data types such as int, char, and bool. Reference types include object, class, interface, and delegate. A value type contains the actual value of the object. That means the actual data is stored in the variable of a value type, whereas a reference type variable […]
Continue reading…

Enjoyed this post? Share it!