Class Cat<T, K>
Here's main class of this Demo.
You can see mostly type of article within this class and you for more detail, please see the remarks.
this class is a template class. It has two Generic parameter. they are: T and K.
The extension method of this class can refer to ICatExtension class
Inherited Members
Namespace: CatLibrary
Assembly: CatLibrary.dll
Syntax
[Serializable]
public class Cat<T, K> : ICat, IAnimal where T : class, new()
where K : struct
Type Parameters
| Name | Description |
|---|---|
| T | This type should be class and can new instance. |
| K | This type is a struct type, class type can't be used for this parameter. |
Remarks
THIS is remarks overridden in MARKDWON file
Examples
Here's example of how to create an instance of this class. As T is limited with class and K is limited with struct.
var a = new Cat(object, int)();
int catNumber = new int();
unsafe
{
a.GetFeetLength(catNumber);
}
As you see, here we bring in pointer so we need to add unsafe keyword.
Constructors
| Improve this Doc View SourceCat()
Default constructor.
Declaration
public Cat()
Cat(T)
Constructor with one generic parameter.
Declaration
public Cat(T ownType)
Parameters
| Type | Name | Description |
|---|---|---|
| T | ownType | This parameter type defined by class. |
Cat(String, out Int32, String, Boolean)
It's a complex constructor. The parameter will have some attributes.
Declaration
public Cat(string nickName, out int age, string realName, bool isHealthy)
Parameters
| Type | Name | Description |
|---|---|---|
| String | nickName | it's string type. |
| Int32 | age | It's an out and ref parameter. |
| String | realName | It's an out paramter. |
| Boolean | isHealthy | It's an in parameter. |
Fields
| Improve this Doc View SourceisHealthy
Field with attribute.
Declaration
[ContextStatic]
[NonSerialized]
public bool isHealthy
Field Value
| Type | Description |
|---|---|
| Boolean |
Properties
| Improve this Doc View SourceAge
Hint cat's age.
Declaration
protected int Age { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Item[String]
This is index property of Cat. You can see that the visibility is different between get and set method.
Declaration
public int this[string a] { protected get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| String | a | Cat's name. |
Property Value
| Type | Description |
|---|---|
| Int32 | Cat's number. |
Name
EII property.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| String |
Methods
| Improve this Doc View SourceOverride CalculateFood Name
It's an overridden summary in markdown format
This is overriding methods. You can override parameter descriptions for methods, you can even add exceptions to methods. Check the intermediate obj folder to see the data model of the generated method/class. Override Yaml header should follow the data structure.
Declaration
public Dictionary<string, List<int>> CalculateFood(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date | This is overridden description for a parameter. |
Returns
| Type | Description |
|---|---|
| Dictionary<String, List<Int32>> | It's overridden description for return. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | This is an |
Equals(Object)
Override the method of Object.Equals(object obj).
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | Can pass any class type. |
Returns
| Type | Description |
|---|---|
| Boolean | The return value tell you whehter the compare operation is successful. |
Overrides
| Improve this Doc View SourceGetTailLength(Int32*, Object[])
It's an unsafe method.
As you see, catName is a pointer, so we need to add unsafe keyword.
Declaration
public long GetTailLength(int *catName, params object[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32* | catName | Thie represent for cat name length. |
| Object[] | parameters | Optional parameters. |
Returns
| Type | Description |
|---|---|
| Int64 | Return cat tail's length. |
Jump(T, K, ref Boolean)
This method have attribute above it.
Declaration
[Conditional("Debug")]
public void Jump(T ownType, K anotherOwnType, ref bool cheat)
Parameters
| Type | Name | Description |
|---|---|---|
| T | ownType | Type come from class define. |
| K | anotherOwnType | Type come from class define. |
| Boolean | cheat | Hint whether this cat has cheat mode. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | This is an argument exception |
Events
| Improve this Doc View SourceownEat
Eat event of this cat
Declaration
public event EventHandler ownEat
Event Type
| Type | Description |
|---|---|
| EventHandler |
Operators
| Improve this Doc View SourceAddition(Cat<T, K>, Int32)
Addition operator of this class.
Declaration
public static int operator +(Cat<T, K> lsr, int rsr)
Parameters
| Type | Name | Description |
|---|---|---|
| Cat<T, K> | lsr | ... |
| Int32 | rsr |
|
Returns
| Type | Description |
|---|---|
| Int32 | Result with int type. |
Explicit(Cat<T, K> to Tom)
Expilicit operator of this class.
It means this cat can evolve to change to Tom. Tom and Jerry.
Declaration
public static explicit operator Tom(Cat<T, K> src)
Parameters
| Type | Name | Description |
|---|---|---|
| Cat<T, K> | src | Instance of this class. |
Returns
| Type | Description |
|---|---|
| Tom | Advanced class type of cat. |
Subtraction(Cat<T, K>, Int32)
Similar with operaotr +, refer to that topic.
Declaration
public static int operator -(Cat<T, K> lsr, int rsr)
Parameters
| Type | Name | Description |
|---|---|---|
| Cat<T, K> | lsr | |
| Int32 | rsr |
Returns
| Type | Description |
|---|---|
| Int32 |
Explicit Interface Implementations
| Improve this Doc View SourceIAnimal.Eat()
EII method.
Declaration
void IAnimal.Eat()
IAnimal.Eat(String)
Implementation of Eat(food)
Declaration
void IAnimal.Eat(string food)
Parameters
| Type | Name | Description |
|---|---|---|
| String | food | Food to eat |
IAnimal.Eat<Tool>(Tool)
EII template method.
Declaration
void IAnimal.Eat<Tool>(Tool a)
where Tool : class
Parameters
| Type | Name | Description |
|---|---|---|
| Tool | a | Tool name. |
Type Parameters
| Name | Description |
|---|---|
| Tool | Tool for eat. |
IAnimal.Item[Int32]
EII index.
Declaration
string IAnimal.this[int a] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | a | Cat's number. |
Returns
| Type | Description |
|---|---|
| String | Cat's name. |
ICat.eat
EII event.
Declaration
event EventHandler ICat.eat
Returns
| Type | Description |
|---|---|
| EventHandler |