C # Study Notes-Basic Knowledge (occasionally updated ),
1. Must the parent class contain Constructors?
The parent class must have a constructor, and can have any parameters.
Constructor is the basic object. If there is no constructor, there is no object. If there is a parameter constructor displayed in the parent class, in subclass inheritance, you must write a constructor to call the constructor of the parent class.
If there is no parameter constructor in the parent class, you can write the constructor of the parent class that is not displayed in the subclass. The system automatically calls the constructor without parameters.
2. Assembly. CreateInstance Method
1 using System. reflection; 2 3 namespace AssemblyTest 4 {5 class Program 6 {7 static void Main (string [] args) 8 {9 Test t; 10 Test e; 11 Test s; 12 string export ename = "AssemblyTest"; 13 14 // Assembly. createInstance method (String typeName) 15 t = (Test) Assembly. load (upload ename ). createInstance (using ename + ". testOne "); 16 t. littleTest (); 17 18 // Assembly. createInstance method (String, writable Boolean) 19 // use the optional Zone Search by case. Search for the specified type from this program, and then use the system activator to create its instance. 20 e = (Test) Assembly. load (upload ename ). createInstance (using ename + ". testTwo ", false); 21 e. littleTest (); 22 23 // Assembly. createInstance method (String, using Boolean, using BindingFlags, using Binder, using Object [], using CultureInfo, using Object []) 24 // use an optional case-sensitive search with the specified culture, parameters, and binding and activation features. From this program, you can find the specified type and use the system activator to create its instance. 25 s = (Test) Assembly. load (upload ename ). createInstance (using ename + ". testThree ", false, BindingFlags. default, null, null); 26 s. littleTest (); 27 28 Console. read (); 29} 30} 31 abstract class Test32 {33 public abstract void LittleTest (); 34} 35 36 37 class TestOne: Test38 {39 public override void LittleTest () 40 {41 Console. writeLine ("I'm testing 1"); 42} 43} 44 45 class TestTwo: Test46 {47 public override void LittleTest () 48 {49 Console. writeLine ("I'm testing 2"); 50} 51} 52 53 class TestThree: Test54 {55 public override void LittleTest () 56 {57 Console. writeLine ("I'm testing 3"); 58} 59} 60 61 62}View Code
Applicable: Find the specified type in the dataset and use the system activator to create its instance.
Using System. Reflection;
(Note: From builder mode attached: http://www.cnblogs.com/Aries-rong/p/7647666.html)
3. Conversion between ushort [] and byte []
4. Sort byte, bit, and bit concepts
Bit ):
Binary bit. BITs are the minimum unit for data storage in the computer, and 11010100 is an 8-bit binary number. A binary digit can only represent the States 0 and 1.
Byte ):
Bytes are the basic unit of data processing in computers. The computer stores and interprets information in bytes. A byte consists of eight binary digits, that is, one byte equals eight bits (1 byte = 8 bits ). Generally, one byte can be stored in one ASCII code, and two bytes can be stored in one Chinese character country mark.
Font length:
The number of digits in each word in a computer is called the word length. The length of a computer refers to the number of binary numbers that can be processed at a time. The data processing rate of a computer is naturally related to the number of digits that can be processed at a time and the speed of operations.
Word Length is an important factor in measuring computer performance.