Abstract class
Abstract methods for abstracting
Abstract methods cannot have method bodies
Abstract methods cannot be instantiated because there are abstract members, and abstract members cannot have the method body
Subclasses must override the abstract method of the parent class
abstract method of parent class cannot be called from the base keyword in a subclass
The abstract method is what the light says and does, but defines the behavior, but the specific implementation is given to the subclass
Abstract classes can have non-abstract members, in order to inherit to subclasses
You can have virtual methods in an abstract class
Subclasses must override the parent class's methods, and the parent class does not have to be instantiated , using abstract classes
Abstract classes are inherited for polymorphic
Abstract members cannot be private
An interface is a special abstract class.
Use interface to define 1 interfaces
The interface indicates that it has some kind of capability
Members that can be defined in an interface
Interface cannot be serialized
The member in the interface is abstract by default
The interface can only define properties, methods, indexers, events
Abstract members cannot have access modifiers, default is public
To implement an interface class, you must implement all the members of the interface
Class does not require the override keyword When implementing members of an interface
When implementing a member, you must ensure that the signature is consistent
Interface is 1 purely for the purpose of canonical implementation class
Abstract class : You can find the parent class, and you want to inherit from the parent class to some member families of the subclass
Interface : Multiple classes have the same method, but cannot find the parent class, you can define the method in the interface, let these classes to implement
1 classes can inherit only 1 parent classes, but can implement multiple interfaces, the parent class to write in the first position, to some extent, solve the problem of the single root of the class,
Interfaces themselves can inherit interfaces and support multiple inheritance
The members of the interface can be implemented as abstract or virtual methods, allowing subclasses of the implementation class to implement
Avoid defining multi-function interfaces to prevent contamination of the interface
Boxing : Converting a value type to a reference type
Unboxing : Converting a reference type to a value type
String Special Reference types
String can be seen as a 1 - character Array
Length indicates the number of characters in a string
A string object cannot be modified once the object is created
When you create 1 string objects, you first go to the string detention pool and look for objects with the same string content.
If there is a direct argument to the object, if there is no new object in the creation
String Common methods :
The Length property represents the number of characters
Empty represents 1 empty strings "" emphasizes not referring to null
Compare comparing the size of 2 strings
Concat the connection string and makes up 1 new strings
Contains () Determines whether the specified string contains the specified string
EndsWith () Determines whether the specified string ends with the specified string
StartsWith () Determines whether the specified string starts with the specified string
Equals (); Determines whether the contents of the specified string are the same as the specified string
Format () formatted string
IndexOf () finds the index of the specified character or string in the string, if not returned-1
LastIndexOf () from the end of the string to the front, the first occurrence of the index of the string
IsNullOrEmpty () Determines whether the specified string is not a null value or a string. Enpty
Remove if only one int type is passed, the previous is preserved, and the subsequent
Replace replacement string
Split returns an array with the specified character split string
Substring Cutting strings
ToCharArray () Converts a string to a character input group
ToLower () Converts a string to lowercase
ToUpper () Converts a string to uppercase
Trim () Remove the spaces before and after the string
When we need a lot of string concatenation we can use the stringbulider class
Dark Horse Self-study 9.29 Learning