Mix string and number during string concatenation - CSharp Language Basics

CSharp examples for Language Basics:string

Description

Mix string and number during string concatenation

Demo Code

using System;/* w w w. jav  a  2  s. co m*/
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
   static void Main(string[] args)
   {
      // Pay special attention when mixing texts with numbers!
      Console.WriteLine("a) " + 1 + 1);
      Console.WriteLine("b) " + (1 + 1));
      Console.WriteLine("c) " + "mostly fun");
   }
}

Result


Related Tutorials