By GokiSoft.com|
14:21 28/05/2021|
C Sharp
[Share Code] Tìm hiểu Partial Class trong lập trình C#
#Program.cs
using System;
using Lesson07.Modals;
namespace Lesson07
{
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Student std = new Student();
std.Input();
std.Display();
}
}
}
#Student02.cs
using System;
namespace Lesson07.Modals
{
public partial class Student
{
public string Rollno { get; set; }
public string Email { get; set; }
public void Display()
{
Console.WriteLine("Hien thi thong tin sinh vien");
}
}
}
#Student01.cs
using System;
namespace Lesson07.Modals
{
public partial class Student
{
public string Fullname { get; set; }
public string Age { get; set; }
public Student()
{
}
public void Input()
{
Console.WriteLine("Nhap du lieu: {0}, {1}, {2}, {3}", Fullname, Age, Rollno, Email);
}
}
}
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)