How to prevent duplicate values in enum?

前端 未结 5 557
挽巷
挽巷 2020-11-30 12:36

I wonder is there a way to prevent an enum with duplicate keys to compile?

For instance this enum below will compile

public         


        
5条回答
  •  眼角桃花
    2020-11-30 12:58

    another solution to have unique values based on selected columns

    var uniqueData = temp.Select(u => new tblschClassSchedule
                {
                    TeacherName = u.TeacherName,
                    SubjectName = u.SubjectName,
    
                }).Distinct() ;
    

    this will get only 2 columns and only unique data for those columns

提交回复
热议问题