0

I'm a beginner in c#, I use visual studio Web.Net to test some code:

protected void Page_Load(object sender, EventArgs e)

//String
          string x = "Welcome in C#";
          string y = "String =" + " " + x; 

//int
            int a = 27;
            int b = 3;
            int c = a / b;

//Float 7 digit 32bit
                      float f1 = 1/6f;

//Double 15-16 digits 64bit
                            double do1 = 1/6d;


//Decimal 28-29 digits 128bit
                              decimal de1 = 1/6m;

string nline = Environment.NewLine;
TextBox1.Text = y 
                + nline + "int =" + " " + c.ToString() 
                + nline + "float 7 digit =" + " " + f1.ToString() 
                + nline + "Double 15-16 digits =" + " " + do1.ToString() 
                + nline + "Decimal 28-29 digits =" + " " + de1.ToString();

Output in Browser: all in TextBox1 in one Line like image.

enter image description here

  • Let's take a step back for a second before we address the actual question. You say you're a beginner. You're currently learning ASP.NET Web Forms, a framework that is long dead. Why learn that? Why not ASP.NET Core MVC, ASP.NET Core Razor Pages, or Angular/React/Vue/etc combined with ASP.NET Core Web API? If you're going to learn something, why not learn something relevant? – mason Nov 23 '21 at 00:22
  • Since this essentially an Html control, use `
    ` instead.
    – yazanpro Nov 23 '21 at 00:28

0 Answers0