上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页
摘要: 使用委托调用比直接调用慢10%,使用反射是直接调用的600倍,当然这取决于方法内部是否还外拉数据,但是反射转委托调用的好处显而易见 所以我们需要使用反射和泛型方法来动态创建委托,并通过这些委托来调用特定的方法 先创建一个带有返回值的 public class RegisterDemo { priva 阅读全文
posted @ 2024-03-15 17:43 孤沉 阅读(42) 评论(0) 推荐(0)
摘要: 1、在项目中我们经常写 string? Message{get;set;} 明明是引用类型,它底下还是会出现波浪线,我们可以打开csproj 找到Nullable将它改为disable,或者删除,它默认是disable <Nullable>disable</Nullable> 2、我们的WPF中可能 阅读全文
posted @ 2024-03-15 17:35 孤沉 阅读(184) 评论(0) 推荐(0)
摘要: 上次说到自动扫描的两种方式,接下来,先看看第一种方法,接口的注册 protected override void RegisterTypes(IContainerRegistry containerRegistry) { TextDemo textDemo = new TextDemo(contai 阅读全文
posted @ 2024-03-10 15:07 孤沉 阅读(29) 评论(0) 推荐(0)
摘要: 今天,我向大家介绍一款WPF后台框架,以及,它的用法。 官网 https://prismlibrary.com/ Prism 框架是一个用于构建松耦合、可维护且可测试的 WPF 和 Xamarin.Forms 应用程序的开源框架。在 Prism 中,IContainerRegistry 接口用于注册 阅读全文
posted @ 2024-03-10 13:58 孤沉 阅读(584) 评论(0) 推荐(0)
摘要: 在java中springboot的配置应用了自动扫描 @ComponentScan(value = {"com.example", "com.fox"}) 而对于Asp.Net Core 可以使用Scrutor static void Main(string[] args) { var collec 阅读全文
posted @ 2024-03-09 14:22 孤沉 阅读(67) 评论(0) 推荐(0)
摘要: 直接上代码 public interface IRepository { Task<bool> QueryAllList(); } public class Repository : IRepository { public Task<bool> QueryAllList() { } } publi 阅读全文
posted @ 2024-03-08 15:15 孤沉 阅读(82) 评论(0) 推荐(0)
摘要: WPF的绑定实在是太强大了 1、正常情况下,我们的绑定是这样的,打印HelloWorld <TextBlock Width="200" Height="30" FontSize="20" Text="{Binding Content}"/> private string _content; publ 阅读全文
posted @ 2024-03-08 09:06 孤沉 阅读(48) 评论(0) 推荐(0)
摘要: 1、ItemsControl用来显示一个数据项的集合,它的底层是一个列表,它可以非常灵活的展示布局和数据 以下是例子 <ItemsControl ItemsSource="{Binding Student}"> <ItemsControl.ItemTemplate> <DataTemplate> < 阅读全文
posted @ 2024-03-08 08:56 孤沉 阅读(272) 评论(0) 推荐(0)
摘要: 在使用WPF的时候对int或者bool类型进行绑定出现InvalidCastException: T for DelegateCommand is not an object nor Nullable. <Button Width="200" Height="30" Content="按钮" Com 阅读全文
posted @ 2024-03-06 12:25 孤沉 阅读(308) 评论(0) 推荐(0)
摘要: 在WPF中有时候不想将命令写在List中,但是却要在前端绑定的List中写入命令 暂时知道两种解决方法 1、 Command="{Binding DataContext.NavicateCommand, RelativeSource={RelativeSource AncestorType=List 阅读全文
posted @ 2024-02-26 17:30 孤沉 阅读(83) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页