摘要:
读写锁: ReaderWriterLockSlim 可以多线程读,但只有一个线程写入;并且写入的时候不能读取,读取的时候不能写入。具体代码如下 测试代码: public class TestReadAndWriteLock { SynchronizedCache cache = new Synchr 阅读全文
摘要:
近期读《Linux内核设计与实现_第三版_清晰中文版》,发现Linux低层数据结构很多都用到红黑树,查查资料说说自己的理解。 红黑树:二叉树+高度限制二叉树:确定了它的查找非常快。高度限制:这个是取普通二叉树和平衡二叉树之间。普通二叉树,只管插入不做调整,可能会出现单链很长。平衡二叉树,所有的链高度 阅读全文
摘要:
直接上代码:只有加入wait才能捕获异常,不然就没有,这个比较鸡肋。本质没有wait,主线程和子线程就没有关系了,也就捕获不到子线程异常了 using System.Collections.Generic; using System.Linq; using System.Text; using Sy 阅读全文
摘要:
直接上代码;说明直接代码里面 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Ta 阅读全文
摘要:
Dictionary原理个人总结: * 微软实现 * 赋值: * 1.将Key用hash函数计算(类似MD5) * 2.将hash结果取余放入hash桶(听起来很高大上,就是放入不同数组,类似hash表) * * 取值:赋值过程差不多,取值时间复杂度基本为1。 * 理解本质:取余计算后,直接取数组下 阅读全文
摘要:
1.下面代码基本实现foreach代码基本实现。 2.Tolist延迟加载原理。 using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Tex 阅读全文
摘要:
拖拽事件: <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .box{ width: 200px; height: 200px; background-color: gree 阅读全文
摘要:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .box{ width: 300px; height: 300px; background-color: red; margi 阅读全文
摘要:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .box{ width: 1000px; margin:100px auto; } .box>div{ width: 300p 阅读全文
摘要:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .box{ width: 1000px; margin:100px auto; } .box>div{ width: 300p 阅读全文