当前位置: 首页>>代码示例>>C#>>正文


C# Classes.Comment方法代码示例

本文整理汇总了C#中Classes.Comment方法的典型用法代码示例。如果您正苦于以下问题:C# Classes.Comment方法的具体用法?C# Classes.Comment怎么用?C# Classes.Comment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Classes的用法示例。


在下文中一共展示了Classes.Comment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main()
 {
     // creating teachers
        // we need e set of discip
     Disciplines disc1 = new Disciplines("Math", 23, 140);
     Disciplines disc2 = new Disciplines("Biology", 23, 140);
     Disciplines disc3 = new Disciplines("OOP", 23, 140);
     IList<Disciplines> disciplines = new List<Disciplines>();
     disciplines.Add(disc1);
     disciplines.Add(disc2);
     disciplines.Add(disc3);
     //disciplines can have comments
     disc1.Comment("I am free this week");
     // and that is the teacher with his disciplines
     Teachers teacher1 = new Teachers("Petrow",disciplines);
     //he can make comments
     teacher1.Comment("Ivancho is bad");
     //you can see his comment
     Console.WriteLine(teacher1.SayComment());
     //we can make second teacher and than a set of teachers
     Teachers teacher2 = new Teachers("Stoqnow", disciplines);
     IList<Teachers> setOfTeachers = new List<Teachers>();
     setOfTeachers.Add(teacher1);
     setOfTeachers.Add(teacher2);
     // to create a class we need and a set of students
     // first we create a few students
     Students student1 = new Students("Ivancho", 7);
     Students student2 = new Students("Mariika", 16);
     Students student3 = new Students("Qworcho",25);
     IList<Students> setOfStudents = new List<Students>();
     setOfStudents.Add(student1);
     setOfStudents.Add(student2);
     setOfStudents.Add(student3);
     // now we can ctreate class
     Classes class1 = new Classes("10b", setOfStudents, setOfTeachers);
     // the classes can make comments
     class1.Comment("We are happy class");
     // finaly we make a list of classes
     Classes class2 = new Classes("11v",setOfStudents,setOfTeachers);
     IList<Classes> setOfClasses = new List<Classes>();
     setOfClasses.Add(class1);
     setOfClasses.Add(class2);
     //school
     School school1 = new School(setOfClasses);
     Console.WriteLine(school1.ToString());
 }
开发者ID:naturalna,项目名称:OOPPrinciples,代码行数:46,代码来源:SchoolEntryPoint.cs


注:本文中的Classes.Comment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。