加载中...

摘要: 1.一个普通的加法如下 internal class Program { private static void Main(string[] args) { int s = sum(10, 20); Console.WriteLine("Sum is: " + s); } private stati 阅读全文
posted @ 2025-02-24 17:02 神乐羊 阅读(12) 评论(0) 推荐(0)
摘要: 需要用的包: 把之前的tcp修改成控件 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System 阅读全文
posted @ 2025-02-20 21:21 神乐羊 阅读(34) 评论(0) 推荐(0)
摘要: 先添加包 代码部分: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; us 阅读全文
posted @ 2025-02-16 14:44 神乐羊 阅读(18) 评论(0) 推荐(0)
摘要: 前端xaml模块 <Window x:Class="Wpf_new.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/ 阅读全文
posted @ 2024-12-13 13:39 神乐羊 阅读(20) 评论(0) 推荐(0)
摘要: 给按钮添加点击事件 给 Button 添加属性 Click,在button后任意地方输入Click,在选择,创建Button_Click事件(将事件绑定到新创建的名为Button_Click) private void Button_Click(object sender, RoutedEventA 阅读全文
posted @ 2024-10-02 13:29 神乐羊 阅读(47) 评论(0) 推荐(0)
摘要: 泛型允许你定义一个类、接口或方法时不指定具体的数据类型,而是使用一个或多个类型参数 类型安全:编译器在编译时检查类型,减少运行时错误。 代码重用:相同的代码可以处理不同的数据类型,避免重复代码。 性能:避免了装箱和拆箱的性能损失,尤其是在处理值类型时。 点击查看代码 using System; us 阅读全文
posted @ 2024-08-03 22:54 神乐羊 阅读(22) 评论(0) 推荐(0)
摘要: 两种遍历方法:for和foreach遍历 点击查看代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using 阅读全文
posted @ 2024-08-03 14:50 神乐羊 阅读(24) 评论(0) 推荐(0)
摘要: 在 C# 中,接口是一种定义了一组方法、属性、事件或索引器的契约,但不提供具体实现。任何类或结构体都可以实现一个或多个接口,从而承诺提供接口中定义的功能。 特点:定义方法:接口只定义方法的签名,没有实现。 多重继承:一个类可以实现多个接口,允许不同类型的行为组合。 多态性:可以通过接口类型引用不同实 阅读全文
posted @ 2024-07-28 22:39 神乐羊 阅读(35) 评论(0) 推荐(0)
摘要: 例子展示: 设置一个动物类,dog类,cat类,使用虚方法改写 点击查看代码 using System; public class Animal { // 声明一个虚方法 public virtual void Speak() { Console.WriteLine("Animal speaks") 阅读全文
posted @ 2024-07-26 10:55 神乐羊 阅读(20) 评论(0) 推荐(0)
摘要: 写一个例子 基类敌人类(hp speed 方法 :move ai )派生出来两个类 boos类 type1enemy类 using System.Collections.Generic; using System.Linq; using System.Text; using System.Threa 阅读全文
posted @ 2024-07-25 22:04 神乐羊 阅读(14) 评论(0) 推荐(0)