C # data structure

Variable Types

  1. Value Type

    1. bool Boolean
    2. btye 8-bit unsigned integer 0x00 ~ 0xff
    3. char 16-bit unsigned integer
    4. decimal 128 decimal place accuracy value of 10
    5. double    64位
    6. float 32 bit
    7. int 32 bit
    8. long 64 Wei
    9. sbyte 8-bit signed
    10. short 16 Wei
    11. uint 32-bit unsigned
    12. ulong 64-bit unsigned
    13. ushort 16-bit unsigned 

           sizeof can get a variable number of bits

  1. Reference types
    1. Reference type does not contain the value stored in the variable, the type of reference point to a memory location
    2. Built-in reference types are object dynamic string
    3. Object Types
    4. Dynamic type
      1. You can store any type of value to a variable take effect at runtime
    5. String type
      1. String str= “Helloworld“;
      2. @ Characters plus guidance, you can put string '\' character to look @ "\\ HelloWorld" == "\ HelloWorld"
      3. String can be any line feeds, spaces and line breaks bonds are considered within the string length
        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Text;
        
        namespace StudentCShrap
        {
            class MainClassTest
            {
                static void Main(string[] args)
                {
                    String str = "Helloworld\n\n\n";
                    Console.WriteLine(str.Length);//13 length
                    str = @"12345897522
                            4152454
                                524154";
                    Console.WriteLine(str.Length);//72 length
                    
        
        
                    Console.ReadKey();
                    
                }
            }
        }
        

         

  2. Pointer types
    1. Another type of memory with the memory address of the C and C ++ pointers have the same effect
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      
      namespace StudentCShrap
      {
          class MainClassTest
          {
              static void Main(string[] args)
              {
                  int* Leng; //错误 CS0214: 指针和固定大小缓冲区只能在不安全的上下文中使用
                  Console.ReadKey();
                  
              }
          }
      }
      

       

Published 24 original articles · won praise 5 · Views 3211

Guess you like

Origin blog.csdn.net/Ellis1993/article/details/105261289