LINQ 速查
常用 LINQ 表达式 标准查询运算符 说明 返回类型 立即执行 延迟流式处理 延迟非流式处理 示例 Where 筛选满足条件的元素 IEnumerable<T> ✅ list.Where(x => x.Age > 20) Select 投影每个元素 IEnumerable<T> ✅ list.Select(x …
2025-6-05 1:13
|
343
|
|
676 字
|
3 分钟
.net webapi Dockerfile 样本
# 请参阅 https://aka.ms/customizecontainer 以了解如何自定义调试容器,以及 Visual Studio 如何使用此 Dockerfile 生成映像以更快地进行调试。 # 在项目目录下编译,因为引用了其它项目,所以指定了上下文目录为解决方案目录 .. # docker build -t generalapi.api…
2025-6-05 0:07
|
398
|
|
46 字
|
3 分钟
wpf 辉光卡片
看到有人用 Avalonia 实现,这里使用 wpf 实现 xaml <Grid> <Grid Width="150" Height="250"> <Grid.Resources> <GradientStopCollection x:Key="Gradien…
2025-6-04 21:17
|
229
|
|
104 字
|
5 分钟
wpf 自定义面板布局
这里实现了一个横向的简易版 StackPanel // 1. 计算需要的尺寸 protected override Size MeasureOverride(Size availableSize) { var resultSize = new Size(); // 需要的总尺寸 var currentLineSize = new Size(); /…
2025-6-04 20:34
|
133
|
|
131 字
|
6 分钟
.net 动态构建 LINQ
var item = Expression.Parameter(typeof(Product), "item"); var name = Expression.Property(item, nameof(Product.Name)); var price = Expression.Property(item, nameof(Pr…
2025-6-04 20:21
|
148
|
|
38 字
|
2 分钟
wpf 启动项目中加入测试后
编译会提示项目中存在多个 Main 方法(即多个入口点) 编译 csproj 文件,加入如下内容 <PropertyGroup> <!-- 指定项目中的启动 App 类的完整名称 --> <StartupObject>WpfDemoApp.App</StartupObject> </Proper…
2025-6-04 20:12
|
126
|
|
42 字
|
1 分钟内
wpf 跟随路径代码方式
使用 StrokeDashOffsetProperty 调整实线填充效果 调用 PathGeometry.GetPointAtFractionLength 获得当前坐标点及方向 xaml <Grid Loaded="FrameworkElement_OnLoaded"> <Grid.Resources> …
2025-6-04 11:51
|
91
|
|
181 字
|
8 分钟
wpf 跟随路径动画方式
xaml <Canvas> <Canvas.Resources> <!-- 1. 定义移动的路径, 这里画了一个五角形 --> <PathGeometry x:Key="MovePathGeometry" Figures="M 175,30 L 213.88,123.63 L …
2025-6-03 20:55
|
109
|
|
47 字
|
3 分钟
wpf 网格背景
原来使用控件,但是鼠标事件会受到子控件影响,现在改成装饰器 xaml <ctrlHelpers:GridLineDecorator> <Canvas /> </ctrlHelpers:GridLineDecorator> cs public class GridLineDecorator : Decorator …
2025-6-03 20:26
|
109
|
|
343 字
|
16 分钟
wpf 波浪进度条
画了个正弦波图形 这里使用其它方式实现 https://www.bilibili.com/video/BV1GL411H746 ,其它 css 中也看过这个思路 xaml <Border BorderBrush="#4d4CAF50" BorderThickness="1" ClipToBounds=&…
2025-6-03 12:36
|
131
|
|
142 字
|
6 分钟