摘要: 1.可存在同名对象 class A: def __init__(self): print('this is class.') def A(): print('this is method.') a = A() # this is method. 由于python是边编译边执行的语言,所以只会使用最近 阅读全文
posted @ 2022-10-14 17:07 Bridgebug 阅读(152) 评论(0) 推荐(0)
摘要: 一、创建类 class People: pass p = People() 二、构造函数 __init__()方法是一种特殊的方法,被称为类的构造函数或初始化方法,当创建了这个类的实例时就会调用该方法。 python中一个类只能有一个构造函数,即只能有一个 __init__ 方法(有多个时,最后一个 阅读全文
posted @ 2022-10-14 16:52 Bridgebug 阅读(83) 评论(0) 推荐(0)
摘要: 由于个人不喜欢定义那么多变量,而在wpf的vm中需触发更新的变量都要定义一个字段和属性。 例如: private string _name; public string Name { get { return _name; } set { _name = value; RaisePropertyCh 阅读全文
posted @ 2022-09-13 11:38 Bridgebug 阅读(96) 评论(0) 推荐(0)
摘要: 通常情况下,是将C#代码共享到python脚本中,可以通过脚本调用C#的各个对象。 一、IronPythonRunner 创建IronPython运行器,可通过该运行器运行python脚本。 using System; using System.Collections.Generic; using 阅读全文
posted @ 2022-08-24 15:09 Bridgebug 阅读(330) 评论(0) 推荐(0)
摘要: 假如有脚本 test1.py def get(): return 'this is test1' 在脚本 test2.py 中调用 test1.py 的 get 方法 1.用全名访问 import test1 print(test1.get()) 2.用别名访问 import test1 as t1 阅读全文
posted @ 2022-07-28 15:31 Bridgebug 阅读(132) 评论(0) 推荐(0)
摘要: 创建SyncingClass类,继承与ContextBoundObject,并标记Synchronization特性; 需实现上下文同步的实例必须继承ContextBoundObject和标记Synchronization特性; using System; using System.Threadin 阅读全文
posted @ 2022-06-22 10:32 Bridgebug 阅读(173) 评论(0) 推荐(0)
摘要: FOR FOR %%variable IN (set) DO command [command-parameters] %variable 指定一个单一字母可替换的参数。 (set) 指定一个或一组文件。可以使用通配符。 command 指定对每个文件执行的命令。 command-parameter 阅读全文
posted @ 2022-04-16 01:16 Bridgebug 阅读(601) 评论(0) 推荐(0)
摘要: 批处理是一种简化的脚本语言,也称作宏。它应用于DOS和Windows系统中,它是由DOS或者Windows系统内嵌的命令解释器(通常是COMMAND. COM或者CMD.EXE)解释运行。类似于Unix中的Shell脚本。批处理文件具有.bat或者.cmd的扩展名。批处理语法中是不区分大小写。 RE 阅读全文
posted @ 2022-04-13 22:17 Bridgebug 阅读(252) 评论(0) 推荐(0)
摘要: 一、Thread (System.Threading) 1.前台线程和后台线程 只要有一个前台线程在运行,应用程序的进程就在运行,直到所有前台线程完成其任务为止。在默认情况下,用 Thread类创建的线程是前台线程。线程池中的线程总是后台线程。在用 Thread类创建线程时,可以设置 IsBackg 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(388) 评论(0) 推荐(0)
摘要: 1.个人类Person public class Person { public Person(string fName, string lName) { this.FirstName = fName; this.LastName = lName; } public string FirstName 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(343) 评论(0) 推荐(0)
摘要: Enumerable.Range(0, 20).Select(i => { long x = 1; for (int j = 1; j <= i; j++) { x *= j; } Console.WriteLine(i + "计算完成"); return x; }); 当你尝试运行上面的代码,会发 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(913) 评论(0) 推荐(0)
摘要: 一、XML的序列化 using System.Xml.Serialization; https://www.cnblogs.com/KeithWang/archive/2012/02/22/2363443.html 1.建立序列化测试对象 [XmlRootAttribute("City", Name 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(202) 评论(0) 推荐(0)
摘要: using System.Collections.Generic; using System.Configuration; //有可能可以using但不能用,需重新添加引用 /// <summary> /// 针对配置文件的读写操作 (App.config) /// ps:key和name都不区分大 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(677) 评论(0) 推荐(0)
摘要: 前言 什么是NuGet? NuGet是.NET的软件包管理器。NuGet客户端工具提供了生成和使用软件包的功能。NuGet Gallery是所有软件包作者和使用者都使用的中央软件包存储库。 包的安装和卸载 (以Newtonsoft.Json举例) 1.控制台 安装:Install-Package N 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(434) 评论(0) 推荐(0)
摘要: 前言:摘抄至 Sql server从入门到精通 密码:yskt 一、事务的概念 事务是由一系列语句构成的逻辑工作单元。事务和存储过程等批处理有一定程度上的相似之处,通常都是为了完成一定业务逻辑而将一条或者多条语句“封装”起来,使它们与其他语句之间出现个逻辑上的边界,并形成相对独立的一个工作单元。 当 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(457) 评论(0) 推荐(0)
摘要: 几个基本类型都有TryParse方法,将object 自动识别类型和转换 using System.Reflection; public static bool TryParse<T>(object val, out T t) { t = default(T); if (val == null) { 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(204) 评论(0) 推荐(0)
摘要: python中有4中不同的数据容器,那分别对应着C#中的哪种数据结构呢? PythonPython描述C#列表list有序可变的,其中的每个值类型可以不一样List<object>,Array,HashSet<object>元组tuple有序但是值不可改变,值类型可以不一样List<object>, 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(93) 评论(0) 推荐(0)
摘要: 如何在C#代码中实例化一个python的类??? IronPython类不是.NET类。它们是IronPython.Runtime.Types.PythonType的实例,它是Python元类。这是因为Python类是动态的,并且支持在运行时添加和删除方法,这是.NET类无法做到的。 class M 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(97) 评论(0) 推荐(0)
摘要: 如何将一个实例对象或者单独一个方法传递到python代码中呢??? class MyClass: i = 123 __name = "NB" fo = None def __init__(self, num): self.i = num def h(self): return "Hello" def 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(53) 评论(0) 推荐(0)
摘要: C#是静态语言,那C#能不能像python一样动态编程呢??? 1.DynamicObject using System; using System.Collections.Generic; using System.Dynamic; using System.Reflection; class P 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(562) 评论(1) 推荐(0)
摘要: 1.DataBindings 控件基类(Control),有一个DataBindings对象,它是一个ControlBindingCollection类,这个类继承与BindingsCollection,里面有一个Binding的列表对象,其中Binding对象是一个记录了属性名,数据源,数据成员等 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(2212) 评论(0) 推荐(0)
摘要: 设置Button元素的FontSize和Background属性,就可以定义WPF元素的外观,如Button元素所示: <Button Content="Button" Width="75" Canvas.Left="350" Canvas.Top="148" Background="Pink" F 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(73) 评论(0) 推荐(0)
摘要: 1.资源介绍 之前讲过直接设置元素的样式,但是直接设置对于样式的共享没有什么帮助。样式可以放在资源中。在资源中,可以把样式赋予指定的元素,把一个样式赋予某一类型的所有元素,或者为该样式使用一个键。要把样式赋予某一个类型的所有元素,可使用Style的TargetType属性,指定x:Type标记扩展{ 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(136) 评论(0) 推荐(0)
摘要: 使用触发器,可以动态地更改控件的外观,因为一些事件或属性值改变了。通常这都必须在代码中实现,使用WPF,也可以用XAML实现,而这只会影响UI。 1.属性触发器 属性触发器在属性值改变时激活。Style类有一个Triggers属性,通过它可以指定属性触发器。 <Window x:Class="Wpf 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(206) 评论(0) 推荐(0)
摘要: 将下述的XAML通过代码实现: <Window x:Class="WpfAppLearn1.Window3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.micro 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(243) 评论(0) 推荐(0)