C # Data Type learning

Source: Internet
Author: User
Tags pow

C # has the following data types:

Data type case and range of values:

Interface:

When you select int:

When Long is selected:

When float is selected:

When Double is selected:

When decimal is selected:

When string is selected:

When Char is selected:

When BOOL is selected:

The source code is as follows:

Using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

Namespace SECONDWPF
{
<summary>
The interactive logic of MainWindow.xaml
</summary>
public partial class Mainwindow:window
{
Public MainWindow ()
{
InitializeComponent ();
}

private void Listbox_selectionchanged (object sender, SelectionChangedEventArgs e)
{

}

        private void Button_Click (object sender, RoutedEventArgs e)
          {
              Close (); Quit System
        }

When the Quit key is pressed

        private void listboxitem_selected (object sender, RoutedEventArgs e)
         {
              int variable,intmax,intmin;
             variable = 42;
             intmax = (int) Math.pow (2, 32)-1;
             intmin = (int) Math.pow (-2, 32);
             value.text = variable. ToString ();
             down.text = intmin.tostring ();
             uper.text = intmax.tostring ();
        }

private void List1_selected (object sender, RoutedEventArgs e)
{
Long Longmax, longmin,variable;
variable = 42L;

Longmax = (Long) Math.pow (2, 63)-1;
Longmin = (long) Math.pow (-2, 63);
Value.text = variable. ToString ();
Down.text = Longmax.tostring ();
Uper.text = Longmin.tostring ();
}

private void List2_selected (object sender, RoutedEventArgs e)
{
float variable;
String Floatmax, Floatmin;
variable = 0.42f;
Floatmax = "(+-) 1.5*10^45";
Floatmin = "(+-) 3.4 * 10 ^ 45";
Value.text = variable. ToString ();
Down.text = Floatmax;
Uper.text = Floatmin;
}

private void List3_selected (object sender, RoutedEventArgs e)
{
Double variable;
String Doublemax;
String doublemin;
variable = 0.43;
Doublemax = "+-5.0*10^-324";
Doublemin = "+-1.7*10^308";
Value.text = variable. ToString ();
Down.text = Doublemax;
Uper.text = Doublemin;

}

private void List4_selected (object sender, RoutedEventArgs e)
{
Decimal coin;
String Decimalmax, Decimalmin;
coin = 0.42M;
Decimalmax = "+-1.0*10^-28";
Decimalmin = "+-7.9*10^28";
Value.text = coin. ToString ();
Down.text = Decimalmax.tostring ();
Uper.text = Decimalmin.tostring ();
}

private void List5_selected (object sender, RoutedEventArgs e)
{
String Vest;
Vest = "Hello!" ";
Value.text = Vest;
Down.text = "NULL";
Uper.text = "NULL";
}

private void List6_selected (object sender, RoutedEventArgs e)
{
Char Grill;
int Charmax, CharMin;
Grill = ' x ';
Charmax = (int) Math.pow (2, 16)-1;
CharMin = 0;
Value.text = Grill. ToString ();
Down.text = Charmin.tostring ();
Uper.text = Charmax.tostring ();
}

private void List7_selected (object sender, RoutedEventArgs e)
{
BOOL teeth;
Teeth = false;
Value.text = teeth. ToString ();
Down.text = "Ture";
Uper.text = "Flase";
}
}
}

C # Data Type learning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.