• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Student类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Student的典型用法代码示例。如果您正苦于以下问题:C# Student类的具体用法?C# Student怎么用?C# Student使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Student类属于命名空间,在下文中一共展示了Student类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            Student student1 = new Student();

            student1.getbyid("D12312312");
            MessageBox.Show(student1.name);
        }
开发者ID:jasonhuber,项目名称:CIS339FallA,代码行数:7,代码来源:Form1.cs


示例2: GetStudent

 public Student GetStudent(string id)
 {
     string sql = "select * from Student where id='{0}'".FormatWith(id);
     SqlDataReader dr = SqlHelper.ExecuteReader(ConStr, CommandType.Text, sql);
     if (dr.HasRows == false) return null;
     dr.Read();
     var stu = new Student(
         dr["Name"].ToString(),
         dr["Id"].ToString(),
         dr["Major"].ToString(),
         dr["Degree"].ToString());
     dr.Close();
     dr.Dispose();
     //访问数据库,获取选课信息
     var attends = new List<Section>();
     string sql1 = @"select * from AttendSection where StudentNumber ='{0}'".FormatWith(id);
     DataTable attendSec = SqlHelper.ExecuteDataset(ConStr, CommandType.Text, sql1).Tables[0];
     var secDAO = new SectionDAO();
     foreach (DataRow r in attendSec.Rows)
     {
         attends.Add(secDAO.GetSection(r["SectionNumber"].ConvertToIntBaseZero()));
     }
     stu.Attends = attends;
     return stu;
 }
开发者ID:starryni9ht,项目名称:SRSOO,代码行数:25,代码来源:StudentDAO.cs


示例3: Main

        static void Main()
        {
            var student1 = new Student("John", "Atanasov", "421586353");

            var studentEqual = new Student("John", "Atanasov", "421586353");
            Console.WriteLine("Different objects with the same properties are equal: {0}",student1.Equals(studentEqual));
            Console.WriteLine();

            Student student1DeepCopy = student1.Clone();
            Console.WriteLine("The copy and the original are the same: {0}", student1.Equals(student1DeepCopy));
            Console.WriteLine("The copy reference the original -> " + ReferenceEquals(student1, student1DeepCopy));
            Console.WriteLine();

            var student2 = new Student("John", "Atanasov", "421586353");
            var student3 = new Student("Peter", "Nikolov", "245124749");
            CompareStudents(student1, student2);
            CompareStudents(student1, student3);
            CompareStudents(student2, student3);
            Console.WriteLine();

            Console.WriteLine(student1.ToString());
            Console.WriteLine();

            student1.MiddleName = "Ivanov";
            student1.MobilePhone = "0885123456";
            student1.Faculty = Faculty.Bachelor;
            student1.University = University.SU;
            Console.WriteLine(student1.ToString());
            Console.WriteLine();
        }
开发者ID:cvet-,项目名称:Telerik_Academy,代码行数:30,代码来源:Program.cs


示例4: Main

        static void Main(string[] args)
        {
            Console.WriteLine(GeometryCalculations.TriangleArea(3, 4, 5));

            Console.WriteLine(NumericConversions.DigitToString(5));

            Console.WriteLine(ArithmethicCalculations.FindMaxValue(5, -1, 3, 2, 14, 2, 3));

            ConsoleMethods.PrintNumberWithPrecision(1.3, 2);
            ConsoleMethods.PrintNumberAsPercentWithPrecision(0.75, 0);
            ConsoleMethods.PrintObjectAsPaddedString(2.30, 8);

            Console.WriteLine(GeometryCalculations.DistanceBetweenTwoPoints(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + GeometryCalculations.IsHorizontal(3, -1, 3, 2.5));
            Console.WriteLine("Vertical? " + GeometryCalculations.IsVertical(3, -1, 3, 2.5));

            Student peter = new Student() { FirstName = "Peter", LastName = "Ivanov" };
            peter.OtherInfo = "From Sofia, born at 17.03.1992";

            Student stella = new Student() { FirstName = "Stella", LastName = "Markova" };
            stella.OtherInfo = "From Vidin, gamer, high results, born at 03.11.1993";

            Console.WriteLine("{0} older than {1} -> {2}",
                peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
开发者ID:niki-funky,项目名称:Telerik_Academy,代码行数:25,代码来源:Demo.cs


示例5: Main

        static void Main(string[] args)
        {
            Instructor EnglishInstructor = new Instructor("John", "English");

            Instructor MathInstructor = new Instructor("Mike", "Math");

            Student Student1 = new Student("Jane", EnglishInstructor);

            Student Student2 = new Student("Joe", EnglishInstructor);

            Student Student3 = new Student("Melissa", MathInstructor);

            Student Student4 = new Student("Matt", MathInstructor);

            EnglishInstructor.SetStudentGrade(Student1, 95);
            EnglishInstructor.SetStudentGrade(Student2, 85);
            MathInstructor.SetStudentGrade(Student3, 90);
            MathInstructor.SetStudentGrade(Student4, 92);

            System.Console.WriteLine("    Student Information    ");
            System.Console.WriteLine(" ");
            Student1.Print();
            Student2.Print();
            Student3.Print();
            Student4.Print();
            System.Console.ReadKey();
        }
开发者ID:kcbwilson,项目名称:IT-1050,代码行数:27,代码来源:Program.cs


示例6: Main

    static void Main(string[] args)
    {
        //Define a class Student, which contains data about a student – first, middle and last name,
        //SSN, permanent address, mobile phone e-mail, course, specialty, university, faculty. Use
        //an enumeration for the specialties, universities and faculties. Override the standard methods,
        //inherited by  System.Object: Equals(), ToString(), GetHashCode() and operators == and !=.
        //Add implementations of the ICloneable interface. The Clone() method should deeply copy all
        //object's fields into a new object of type Student.
        //Implement the  IComparable<Student> interface to compare students by names (as first criteria,
        //in lexicographic order) and by social security number (as second criteria, in increasing order).

        //Making student and test override ToString method
        Student peter = new Student("Peter", "Ivanov", "Petrov", 12764397, "Sofia,Mladost1,Al. Malinov str.", 0889888888,
            "[email protected]", 2, Universities.SofiaUniversity, Faculties.HistoryFaculty, Specialties.History);
        Console.WriteLine(peter);
        Console.WriteLine();

        //Make second student who is deep clone of the first one and test this
        Student ivo = peter.Clone();
        Console.WriteLine(ivo);
        ivo.FirstName = "Joro";
        Console.WriteLine(ivo.FirstName);
        Console.WriteLine(peter.FirstName);
        Console.WriteLine();

        //Testing override method CompareTo
        Console.WriteLine(peter.CompareTo(ivo));
        ivo.FirstName = "Peter";
        Console.WriteLine(peter.CompareTo(ivo));
    }
开发者ID:Jarolim,项目名称:TelerikAcademy-1,代码行数:30,代码来源:Program.cs


示例7: AddStudentToCourseOffering

 /// <summary>
 /// Adds the student to a course offering.
 /// </summary>
 /// <param name="student">The student.</param>
 /// <param name="courseOfferingId">The course offering identifier.</param>
 public void AddStudentToCourseOffering(Student student, int courseOfferingId)
 {
     using (_courseOfferingRepository)
     {
         _courseOfferingRepository.InsertStudentIntoCourseOffering(student, courseOfferingId);
     }
 }
开发者ID:davericher,项目名称:cst8256,代码行数:12,代码来源:CourseService.cs


示例8: StudentLeavingCourseShouldNotThrowException

 public void StudentLeavingCourseShouldNotThrowException()
 {
     Student student = new Student("Humpty Dumpty", 10000);
     Course course = new Course("Unit Testing");
     student.AttendCourse(course);
     student.LeaveCourse(course);
 }
开发者ID:studware,项目名称:Ange-Git,代码行数:7,代码来源:StudentTests.cs


示例9: Main

        static void Main(string[] args)
        {
            Instructor John = new Instructor("John", "English");
            Instructor Mike = new Instructor("MIKE", "Math");

            Student Jane = new Student("Jane", John);
            Student Joe = new Student("Joe", John);

            Student Melissa = new Student("Melissa", Mike);
            Student Matt = new Student("Matt", Mike);

            John.SetStudentGrade(Jane, 95);
            John.SetStudentGrade(Joe, 85);
            Mike.SetStudentGrade(Melissa, 90);
            Mike.SetStudentGrade(Matt, 92);

            Jane.PrintStudentInfo();
            Joe.PrintStudentInfo();
            Melissa.PrintStudentInfo();
            Matt.PrintStudentInfo();

            System.Console.WriteLine();
            System.Console.ReadKey();


        }
开发者ID:Madhunayak,项目名称:IT1050,代码行数:26,代码来源:Program.cs


示例10: Main

        static void Main(string[] args)
        {
            //Create Instructor 
            Instructor John = new Instructor("John", "English");
            Instructor Mike = new Instructor("Mike", "Math");

            //Create Students
            Student Jane = new Student("Jane", John);
            Student Joe = new Student("Joe", John);
            Student Melissa = new Student("Melissa", Mike);
            Student Matt = new Student("Matt", Mike);

            //Instructor Set Student Grade
            John.StudentGrade(Jane, 95);
            John.StudentGrade(Joe, 85);
            Mike.StudentGrade(Melissa, 90);
            Mike.StudentGrade(Matt, 92);

            //Print Instructor Information
            John.PrintInstructorInfo();
            Mike.PrintInstructorInfo();

            //Print Student Information
            Jane.PrintStudentInfo();
            Joe.PrintStudentInfo();
            Melissa.PrintStudentInfo();
            Matt.PrintStudentInfo();

            System.Console.ReadKey();

        }
开发者ID:jeanne27king,项目名称:IT1050,代码行数:31,代码来源:Program.cs


示例11: create

        public static Student create(string matricId, string password, string name = "student")
        {
            using (var context = new EventContainer())
            {

                var existedStudent = (from s in context.Students.Include("OwnedEvents").Include("RegisteredEvents")
                                      where s.MatricId == matricId
                                      select s).FirstOrDefault();

                if (existedStudent != null)
                {
                    // a student with this matriculation number exists
                    return existedStudent;
                }

                var newStudent = new Student
                {
                    MatricId = matricId,
                    Password = password,
                    Name = name,
                };
                context.Students.Add(newStudent);
                context.SaveChanges();
                return newStudent;
            }
        }
开发者ID:sagittaros,项目名称:EventManagerModel,代码行数:26,代码来源:StudentModel.cs


示例12: Main

        static void Main(string[] args)
        {
            //Create 3 test students
            Student firstStudent = new Student("Gosho", "Ivanov", "Peshov", "11122", "Gosho Street", "02423423", "[email protected]", 1,
                Universities.HarvardUniversity, Faculties.FacultyOfComputerScience ,Specialties.ComputerGraphics);
            Student secondStudent = new Student("Ivan", "Georgiev", "Alexandrov", "15624", "Pesho Street", "09415743", "[email protected]", 2,
                Universities.MassachusettsInstituteofTechnology, Faculties.FacultyOfComputerScience, Specialties.ArtificialIntelligence);
            Student thirdStudent = new Student("Gosho", "Ivanov", "Peshov", "10021", "Ivan Street", "931234", "[email protected]", 1,
                Universities.SofiaUniversity, Faculties.FacultyOfComputerScience, Specialties.ComputerProgramming);

            //Clone a student from the first
            Student clonedStundent = firstStudent.Clone() as Student;

            Console.WriteLine(firstStudent.ToString());
            Console.WriteLine(secondStudent.ToString());
            Console.WriteLine(thirdStudent.ToString());
            Console.WriteLine("First student == Second Student ?:{0}", firstStudent == secondStudent);
            Console.WriteLine("First student != Third Student ?:{0}", firstStudent != thirdStudent);
            Console.WriteLine("First student Equals Cloned Student ?:{0}", firstStudent.Equals(clonedStundent));
            Console.WriteLine("First student compared to Second Student (in ints): {0}", firstStudent.CompareTo(secondStudent));
            Console.WriteLine("First student compared to Third Student (in ints): {0}", firstStudent.CompareTo(thirdStudent));
            Console.WriteLine("First student compared to Cloned Student (in ints): {0}", firstStudent.CompareTo(clonedStundent));

            //Before change
            Console.WriteLine("Is first student number equal to cloned first student number ? {0}", firstStudent.MobilePhone == clonedStundent.MobilePhone);
            //The first student changes his number
            firstStudent.MobilePhone = "088888888";

            //Compare the cloned first student to the changed one
            Console.WriteLine("Is first student number equal to cloned first student number ? {0}", firstStudent.MobilePhone == clonedStundent.MobilePhone);
        }
开发者ID:NikolayGenov,项目名称:TelerikAcademy,代码行数:31,代码来源:TestClass.cs


示例13: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            //connect
            using (DefaultConnection db = new DefaultConnection())
            {
                //creating new student
                Student stu = new Student();
                Int32 StudentID = 0;
                //check for a url
                if (!String.IsNullOrEmpty(Request.QueryString["StudentID"]))
                {
                    //get the id
                     StudentID = Convert.ToInt32(Request.QueryString["StudentID"]);

                    //look up student
                    stu = (from s in db.Students
                           where s.StudentID == StudentID
                           select s).FirstOrDefault();
                }

                //properties for new students
                stu.LastName = txtLast.Text;
                stu.FirstMidName = txtFirst.Text;
                stu.EnrollmentDate = Convert.ToDateTime(txtEnroll.Text);
                if (StudentID == 0)
                {
                    db.Students.Add(stu);
                }

                //save new students
                db.SaveChanges();
                //send back to student page
                Response.Redirect("Students.aspx");
            }
        }
开发者ID:vatcheati,项目名称:comp2084-lab2,代码行数:35,代码来源:student-details.aspx.cs


示例14: CanHandleQueriesOnDictionaries

        public void CanHandleQueriesOnDictionaries()
        {
            using(var store = NewDocumentStore())
            {
                using (var session = store.OpenSession())
                {
                    //now the student:
                    var student = new Student
                    {
                        Attributes = new Dictionary<string, string>
                        {
                            {"NIC", "studentsNICnumberGoesHere"}
                        }
                    };
                    session.Store(student);
                    session.SaveChanges();
                }


                //Testing query on attribute
                using (var session = store.OpenSession())
                {
                    var result = from student in session.Query<Student>()
                                 where student.Attributes["NIC"] == "studentsNICnumberGoesHere"
                                 select student;

                    var test = result.ToList();

                    Assert.NotEmpty(test);
                }
            }
            
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:33,代码来源:LinqOnDictionary.cs


示例15: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        lblError.Text = "";
        Label1.Visible = true;
        Label2.Visible = true;
        Label3.Visible = true;
        Label4.Visible = true;
        string  BannerID= (Request.QueryString["bannerid"] == null) ? "0" : Convert.ToString(Request.QueryString["bannerid"]);

        Session["BannerID"] = BannerID;
        Student std = new Student();
        std = std.GetStudentByStudentBannerID(BannerID);
        if (std != null)
        {
            lblBannerID.Text = std.StudentID;
            lblFirstName.Text = std.FirstName;
            lblLastName.Text = std.LastName;
            lblMiddleName.Text = std.MiddleName;
            lblTerm.Text = std.ProgramEnrollment;
            lblProgram.Text = std.MajorProgramEnrollment;
        }
        else if (std == null || BannerID=="0")
        {
            Label1.Visible = false ;
            Label2.Visible = false ;
            Label3.Visible = false ;
            Label4.Visible = false ;
            lblError.Text = "Error Occured During Registration Process. Please Try again...";
        }
    }
开发者ID:mominbd,项目名称:testing,代码行数:30,代码来源:FinishRegistration.aspx.cs


示例16: FirstLastNameCompare

 private static Student[] FirstLastNameCompare(Student[] students)
 {
     return students
         .Where(x => x.FirstName.CompareTo(x.LastName) < 0)
         .Select(x => x)
         .ToArray<Student>();
 }
开发者ID:p0150n,项目名称:TelerikAcademy,代码行数:7,代码来源:FirstBeforeLast.cs


示例17: CourseShouldThrowExceptionWhenExistingStudentAdded

 public void CourseShouldThrowExceptionWhenExistingStudentAdded()
 {
     var course = new Course("HQC");
     Student student = new Student("Nikolay Kostov", 10000); 
     course.AddStudent(student);
     course.AddStudent(student);
 }
开发者ID:b-slavov,项目名称:Telerik-Software-Academy,代码行数:7,代码来源:CourseTests.cs


示例18: FirstLastNameCompareLinq

 private static Student[] FirstLastNameCompareLinq(Student[] students)
 {
     var result = from student in students
                  where student.FirstName.CompareTo(student.LastName) < 0
                  select student;
     return result.ToArray();
 }
开发者ID:p0150n,项目名称:TelerikAcademy,代码行数:7,代码来源:FirstBeforeLast.cs


示例19: Main

        static void Main()
        {
            Student pesho = new Student("Pesho", "Peshev", "Peshev", 10025030, "Mladost 1", "+359888777222", "[email protected]", 2, Specialty.Engineering, University.TU, Faculty.FEn);

            Student gosho = new Student("Gosho", "Goshev", "Goshev", 10030020, "Druzhba 2", "0888500300", "[email protected]", 3, Specialty.Informatics, University.SofiaUniversity, Faculty.FI);

            Console.WriteLine(new string('-',50));
            Console.WriteLine("Getting hashcodes: ");
            Console.WriteLine(pesho.GetHashCode());
            Console.WriteLine(gosho.GetHashCode());
            Console.WriteLine(new string('-', 50));
            Console.WriteLine(pesho);
            Console.WriteLine(gosho);
            Console.WriteLine(new string('-', 50));
            Console.WriteLine("Is pesho equal to gosho?");
            Console.WriteLine(pesho.Equals(gosho));
            Console.WriteLine(pesho==gosho);
            Console.WriteLine("Is pesho different from gosho?");
            Console.WriteLine(pesho!=gosho);
            Console.WriteLine(new string('-', 50));

            Student pesho1 = pesho.Clone() as Student;
            Console.WriteLine(pesho1);
            Console.WriteLine(new string('-', 50));
            Console.WriteLine(pesho.CompareTo(gosho));
            Console.WriteLine(gosho.CompareTo(pesho));
            Console.WriteLine(pesho.CompareTo(pesho1));
        }
开发者ID:AYankova,项目名称:CSharp,代码行数:28,代码来源:StudentsTest.cs


示例20: Main

    static void Main()
    {
        Disciplines disclineOne = new Disciplines("math", 10, 12);
           Disciplines[] discipline = new Disciplines[] { disclineOne};

           Teacher teacherOne = new Teacher("Ivan Ivanov", discipline);
           Teacher[] teachers = new Teacher[] { teacherOne };

           Student studentOne = new Student("Stoyan", 1);
           Student studentTwo = new Student("Daniel", 2);
           Student studentThree = new Student("Yavor", 3);
           Student studentFour = new Student("Pesho", 5);
           Student studentFive = new Student("Darin", 8);
           Student [] students = new Student[]{studentOne,studentTwo,studentThree,studentFour,studentFive};

           ClassesOfStudents classOne = new ClassesOfStudents(teachers, students, "6C");

           classOne.AddTeacher(teacherOne);
           classOne.AddStudent(studentOne);
           classOne.AddStudent(studentFour);

           foreach (var s in students)
           {
           Console.WriteLine("Name of student:{0}",s.Name);
           }

           studentOne.AddText("vacation is over");
           Console.WriteLine("The commnent of student is: {0}", studentOne.FreeTexts[0]);
    }
开发者ID:KaloyanBobev,项目名称:OOP,代码行数:29,代码来源:ClassDiagramOfSchool.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# StudyStorageLocation类代码示例发布时间:2022-05-24
下一篇:
C# StubViewData类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap