认为
有一个趋势类。
public class Trend{
public string TrendName { get; set; }
public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
例如
new Trend() { TrendName= "Pizza", Description="yum yum" };
new Trend() { TrendName= "Clothing", Description="ba yum" };
new Trend() { TrendName= "Food" };
Run Code Online (Sandbox Code Playgroud)
有一个 Person 类。
public class Person {
public string PersonName { get; }
public int PersonId { get; }
public int aptitude { get; }
...... many other properties
}
Run Code Online (Sandbox Code Playgroud)
例如
new Person() { PersonName = "Arnold …
Run Code Online (Sandbox Code Playgroud) 假设已编写一个方法,该方法需要一个排序列表作为其输入之一。当然,这将在代码中进行注释和记录,参数将被命名为“sortedList”,但如果有人忘记了,就会出现错误。
有没有办法强制输入必须排序?我正在考虑创建一个带有列表和布尔值“排序”的新对象类,并且传递的对象必须是该对象,然后该方法立即检查“排序”布尔值是否为真。但我觉得必须有更好/标准的方法。
*这个方法是在循环中调用的,所以不想在方法内部进行排序。
我上课了
public class StudentProfile
{
public string Name {get; set;}
public string ContactAddress {get; set;}
public DateTime CreatedDate{get; set;}
public double PredictedIQScore {get; set;}
public double PredictedEQScore {get; set;}
public double Param1 {get; set;}
public double Param2 {get; set;}
public double Param3 {get; set;}
...
public double Param20 {get; set;}
}
Run Code Online (Sandbox Code Playgroud)
我有另一个类StudentProfileEvaluation,它是参考StudentProfile构造的.有不同的评估方法可以根据StudentProfile的param值计算学生的IQ和EQ.
这个类的目的,StudentProfileEvaluation是存储这些信息.
public class StudentProfileEvaluation
{
public StudentProfileEvaluation(StudentProfile studentProfile)
{
ParentStudentProfile = studentProfile;
}
public readonly ParentStudentProfile;
private double? predictedIQScore;
private double? predictedEQScore;
public double PredictedIQScore
{
get
{ …
Run Code Online (Sandbox Code Playgroud)