Transferred from: Model-engineering implementation and expansion (Design Mode C)
Http://www.cnblogs.com/callwangxiang/
Self-Test
Assume that you complete the serialization of an enterprise reporting dataProgramThe Enterprise Information entity must follow the "Computer Information System Integration Qualification"1The level requirement serializes the information that meets the reporting conditions. Refer to the custom deep replication method described in this chapter to implement prototype objects and pass unit test verification.
For the convenience of examples, "Computer Information System Integration qualifications"1Level requirements are excerpted as follows:
1,At least two items have been completed in the last three years.3000System integration items of more than 10 million RMBContents
2,Number of project managers with Computer Information System Integration not less25The number of senior project managers is not less8Name
The example does not review whether the enterprise meets the reporting requirements as a whole, but only filters the class members that meet the reporting requirements. The data structure involved in the example is as follows. Please modify itEnterpriseClass is the prototype:
[Serializable]
Class Project
{
/// <Summary>
/// End year
/// </Summary>
Public Int Endyear { Get ; Set ;}
/// <Summary>
///Project funding Scale (RMB)
/// </Summary>
Public DoubleScale {Get;Set;}
}
[Flags]
Enum Qualificationoptions
{
Assisstant, // Support level
Professional, // Expert Level
Senior, // Advanced and senior
Principal // Director/Director level
}
[Serializable]
Class Certification: icomparable < Certification >
{
Public String Name { Get ; Set ;}
Public Qualificationoptions qualification { Get ; Set ;}
Public Int Compareto (certification other)
{
If (Other = Null ) Throw New Argumentnullexception ( " Other " );
If ( ! String . Equals (other. Name, name )) Throw New Notsupportedexception ();
If (Qualification = Other. Qualification) Return 0 ;
Return Qualification > Other. Qualification ? 1 : - 1 ;
}
}
[Serializable]
ClassEmployee
{
Public StringName {Get;Set;}
PublicCertification [] certificates {Get;Set;}
}
[Serializable]
Class Enterprise: iserializable
{
Public String Name { Get ; Set ;}
Public Project [] Projects { Get ; Set ;}
Public Employee [] staff { Get ; Set ;}
}