Mega Code Archive

 
Categories / C# / Development Class
 

Inserts various data types

using System; using System.Text; class Sample  {     static StringBuilder sb;     public static void Main()      {         string      xyz       = "xyz";         char[]      abc       = {'a', 'b', 'c'};         char        star      = '*';         Object   obj       = 0;              bool        xBool     = true;         byte        xByte     = 1;         short       xInt16    = 2;         int         xInt32    = 3;         long        xInt64    = 4;         Decimal     xDecimal  = 5;         float       xSingle   = 6.6F;         double      xDouble   = 7.7;              ushort      xUInt16   = 8;         uint        xUInt32   = 9;         ulong       xUInt64   = 10;         sbyte       xSByte    = -11;              sb = new StringBuilder();              sb.Insert(3, xyz, 2);         sb.Insert(3, xyz);         sb.Insert(3, star);         sb.Insert(3, abc);         sb.Insert(3, abc, 1, 2);         sb.Insert(3, xBool);     // True         sb.Insert(3, obj);       // 0         sb.Insert(3, xByte);     // 1         sb.Insert(3, xInt16);    // 2         sb.Insert(3, xInt32);    // 3         sb.Insert(3, xInt64);    // 4         sb.Insert(3, xDecimal);  // 5         sb.Insert(3, xSingle);   // 6.6         sb.Insert(3, xDouble);   // 7.7         sb.Insert(3, xUInt16);   // 8         sb.Insert(3, xUInt32);   // 9         sb.Insert(3, xUInt64);   // 10         sb.Insert(3, xSByte);    // -11     } }