c# 기초구문 업데이트 완료

This commit is contained in:
2025-03-05 11:57:12 +09:00
parent 15885a2286
commit 6ebd0fb5a9
22 changed files with 740 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
+64
View File
@@ -0,0 +1,64 @@
internal class Program
{
private static void Main(string[] args)
{
var cls = new Class1();
cls.Run();
cls.Get();
cls.Put();
}
}
// 1. Partial Class - 3개로 분리한 경우
partial class Class1
{
public void Run() { }
}
partial class Class1
{
public void Get() { }
}
partial class Class1
{
public void Put() { }
}
// 2. Partial Struct
partial struct Struct1
{
public int ID;
}
partial struct Struct1
{
public string Name;
public Struct1(int id, string name)
{
this.ID = id;
this.Name = name;
}
}
// 3. Partial Interface
partial interface IDoable
{
string Name { get; set; }
}
partial interface IDoable
{
void Do();
}
// IDoable 인터페이스를 구현
public class DoClass : IDoable
{
public string Name { get; set; }
public void Do()
{
}
}