好了,之前的博文中详细的解释了一些辅助的类和辅助的函数,接下来就是使用它们来实现酷炫功能的时候,正所谓磨刀不误砍柴工啊

我们先把总的功能罗列出来

1. json转字典              + (NSDictionary *)_yy_dictionaryWithJSON:(id)json

2. json转模型              + (instancetype)yy_modelWithJSON:(id)json

3. 字典转模型              + (instancetype)yy_modelWithDictionary:(NSDictionary *)dictionary

4. 模型转json               - (id)yy_modelToJSONObject

5. 模型转NSData          - (NSData *)yy_modelToJSONData

6. 模型转json字符串      - (NSString *)yy_modelToJSONString

7. 模型copy                 - (id)yy_modelCopy

8. 模型归档解档            - (id)yy_modelInitWithCoder:(NSCoder *)aDecoder  /   - (void)yy_modelEncodeWithCoder:(NSCoder *)aCoder

9. 模型hash值              - (NSUInteger)yy_modelHash

10. 模型是否相等           - (BOOL)yy_modelIsEqual:(id)model

11. 模型描述                 - (NSString *)yy_modelDescription

功能我们已经清楚了 下边我们看看具体的实现

1.

 /**
* 把id类型的数据转换成字典
*
* @param json 这个id类型为 NSDictionary / NSString / NSData
*
* @return 字典 / 可能为空
*/
+ (NSDictionary *)_yy_dictionaryWithJSON:(id)json { // 判空处理
if (!json || json == (id)kCFNull) return nil; // 定义返回的数据 和把json转为NSData的临时变量
NSDictionary *dic = nil;
NSData *jsonData = nil; // 字典 直接赋值
if ([json isKindOfClass:[NSDictionary class]]) {
dic = json; // 字符串 转成NSData
} else if ([json isKindOfClass:[NSString class]]) {
jsonData = [(NSString *)json dataUsingEncoding : NSUTF8StringEncoding]; // NSData 直接赋值
} else if ([json isKindOfClass:[NSData class]]) {
jsonData = json;
} // 把NSData 转为 字典
if (jsonData) {
dic = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:NULL];
if (![dic isKindOfClass:[NSDictionary class]]) dic = nil;
}
return dic;
}

2.

 /**
* json转模型
*
* @param json json 这个id类型为 NSDictionary / NSString / NSData
*
* @return 模型 / 可能为空
*/
+ (instancetype)yy_modelWithJSON:(id)json { // 先把json转为字典
NSDictionary *dic = [self _yy_dictionaryWithJSON:json]; // 调用yy_modelWithDictionary函数把字典转换成模型
return [self yy_modelWithDictionary:dic];
}

3.

 /**
* 字典转模型
*
* @param dictionary 字典
*
* @return 模型 / 可能为空
*/
+ (instancetype)yy_modelWithDictionary:(NSDictionary *)dictionary { // 判空 / 判断类型
if (!dictionary || dictionary == (id)kCFNull) return nil;
if (![dictionary isKindOfClass:[NSDictionary class]]) return nil; // 获取自身的类型
Class cls = [self class]; // 新建一个model抽象类
_YYModelMeta *modelMeta = [_YYModelMeta metaWithClass:cls]; // 判断有没有自定义返回类型,有就返回自定义的类型
if (modelMeta->_hasCustomClassFromDictionary) {
cls = [cls modelCustomClassForDictionary:dictionary] ?: cls;
} // 创建一个该类的实例对象
NSObject *one = [cls new]; // 调用yy_modelSetWithDictionary方法给新建的对象赋值
if ([one yy_modelSetWithDictionary:dictionary]) return one;
return nil;
}
 /**
* 辅助赋值函数
*
* @param json json 这个id类型为 NSDictionary / NSString / NSData
*
* @return 模型 / 可能为空
*/
- (BOOL)yy_modelSetWithJSON:(id)json { // 先转字典
NSDictionary *dic = [NSObject _yy_dictionaryWithJSON:json]; // 调用yy_modelSetWithDictionary函数赋值并返回对象
return [self yy_modelSetWithDictionary:dic];
}
 /**
* 通过字典给模型对象赋值
*
* @param dic 字典
*
* @return 赋值是否成功
*/
- (BOOL)yy_modelSetWithDictionary:(NSDictionary *)dic { // 判空 / 判断类型
if (!dic || dic == (id)kCFNull) return NO;
if (![dic isKindOfClass:[NSDictionary class]]) return NO; // 新建一个model抽象类
_YYModelMeta *modelMeta = [_YYModelMeta metaWithClass:object_getClass(self)];
// 没有可映射的属性就返回NO
if (modelMeta->_keyMappedCount == ) return NO; // 这里添加了一个判断,如果用户写了NO 就没必要走下边的代码了
if (!modelMeta->_hasCustomTransformFromDictionary) {
return NO;
} // 如果对字典做过自定义的描述,对字典做进一步的处理
if (modelMeta->_hasCustomWillTransformFromDictionary) {
dic = [((id<YYModel>)self) modelCustomWillTransformFromDictionary:dic];
if (![dic isKindOfClass:[NSDictionary class]]) return NO;
} // 创建ModelSetContext结构体
ModelSetContext context = {};
context.modelMeta = (__bridge void *)(modelMeta);
context.model = (__bridge void *)(self);
context.dictionary = (__bridge void *)(dic); // 如果模型中的属性个数大于字典的个数,以字典为主
if (modelMeta->_keyMappedCount >= CFDictionaryGetCount((CFDictionaryRef)dic)) { //CFDictionaryApplyFunction
CFDictionaryApplyFunction((CFDictionaryRef)dic, ModelSetWithDictionaryFunction, &context); // _keyPathPropertyMetas
if (modelMeta->_keyPathPropertyMetas) {
CFArrayApplyFunction((CFArrayRef)modelMeta->_keyPathPropertyMetas,
CFRangeMake(, CFArrayGetCount((CFArrayRef)modelMeta->_keyPathPropertyMetas)),
ModelSetWithPropertyMetaArrayFunction,
&context);
} // _multiKeysPropertyMetas
if (modelMeta->_multiKeysPropertyMetas) {
CFArrayApplyFunction((CFArrayRef)modelMeta->_multiKeysPropertyMetas,
CFRangeMake(, CFArrayGetCount((CFArrayRef)modelMeta->_multiKeysPropertyMetas)),
ModelSetWithPropertyMetaArrayFunction,
&context);
}
} else {
CFArrayApplyFunction((CFArrayRef)modelMeta->_allPropertyMetas,
CFRangeMake(, modelMeta->_keyMappedCount),
ModelSetWithPropertyMetaArrayFunction,
&context);
} // 通过自定义的modelCustomTransformFromDictionary方法来确定是否要转模型
if (modelMeta->_hasCustomTransformFromDictionary) {
return [((id<YYModel>)self) modelCustomTransformFromDictionary:dic];
} return YES;
}

4.

 /**
* 模型转json对象
*
* @return 返回字典或者数组 / 可能为空
*/
- (id)yy_modelToJSONObject {
/*
Apple said:
The top level object is an NSArray or NSDictionary.
All objects are instances of NSString, NSNumber, NSArray, NSDictionary, or NSNull.
All dictionary keys are instances of NSString.
Numbers are not NaN or infinity.
*/ // 使用ModelToJSONObjectRecursive转换不合法的转json数据
id jsonObject = ModelToJSONObjectRecursive(self);
if ([jsonObject isKindOfClass:[NSArray class]]) return jsonObject;
if ([jsonObject isKindOfClass:[NSDictionary class]]) return jsonObject;
return nil;
}

5.

 /**
* 模型转jsonData
*
* @return NSData
*/
- (NSData *)yy_modelToJSONData {
id jsonObject = [self yy_modelToJSONObject];
if (!jsonObject) return nil;
return [NSJSONSerialization dataWithJSONObject:jsonObject options: error:NULL];
}

6.

 - (NSString *)yy_modelToJSONString {
NSData *jsonData = [self yy_modelToJSONData];
if (jsonData.length == ) return nil;
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}

7.

 /**
* 对原有模型的copy
*
* @return 生成一个新的或者本身对象
*/
- (id)yy_modelCopy{ // kCFNull 就返回自身
if (self == (id)kCFNull) return self; // 新建一个model抽象类
_YYModelMeta *modelMeta = [_YYModelMeta metaWithClass:self.class]; // 如果是ns类型 直接返回自身的copy对象
if (modelMeta->_nsType) return [self copy]; // 新建一个自身对象,然后便利所有的属性
NSObject *one = [self.class new];
for (_YYModelPropertyMeta *propertyMeta in modelMeta->_allPropertyMetas) { // 略去没有setter 或者 getter 方法的属性
if (!propertyMeta->_getter || !propertyMeta->_setter) continue; // 处理属性为c的情况
if (propertyMeta->_isCNumber) {
switch (propertyMeta->_type & YYEncodingTypeMask) {
case YYEncodingTypeBool: {
bool num = ((bool (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, bool))(void *) objc_msgSend)((id)one, propertyMeta->_setter, num);
} break;
case YYEncodingTypeInt8:
case YYEncodingTypeUInt8: {
uint8_t num = ((bool (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, uint8_t))(void *) objc_msgSend)((id)one, propertyMeta->_setter, num);
} break;
case YYEncodingTypeInt16:
case YYEncodingTypeUInt16: {
uint16_t num = ((uint16_t (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, uint16_t))(void *) objc_msgSend)((id)one, propertyMeta->_setter, num);
} break;
case YYEncodingTypeInt32:
case YYEncodingTypeUInt32: {
uint32_t num = ((uint32_t (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, uint32_t))(void *) objc_msgSend)((id)one, propertyMeta->_setter, num);
} break;
case YYEncodingTypeInt64:
case YYEncodingTypeUInt64: {
uint64_t num = ((uint64_t (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, uint64_t))(void *) objc_msgSend)((id)one, propertyMeta->_setter, num);
} break;
case YYEncodingTypeFloat: {
float num = ((float (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, float))(void *) objc_msgSend)((id)one, propertyMeta->_setter, num);
} break;
case YYEncodingTypeDouble: {
double num = ((double (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, double))(void *) objc_msgSend)((id)one, propertyMeta->_setter, num);
} break;
case YYEncodingTypeLongDouble: {
long double num = ((long double (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, long double))(void *) objc_msgSend)((id)one, propertyMeta->_setter, num);
} // break; commented for code coverage in next line
default: break;
}
} else {
switch (propertyMeta->_type & YYEncodingTypeMask) {
case YYEncodingTypeObject:
case YYEncodingTypeClass:
case YYEncodingTypeBlock: {
id value = ((id (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, id))(void *) objc_msgSend)((id)one, propertyMeta->_setter, value);
} break; // 特别之处这里获取的是指针,之所以使用size_t 是考虑到平台方面的东西
case YYEncodingTypeSEL:
case YYEncodingTypePointer:
case YYEncodingTypeCString: {
size_t value = ((size_t (*)(id, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_getter);
((void (*)(id, SEL, size_t))(void *) objc_msgSend)((id)one, propertyMeta->_setter, value);
} break;
case YYEncodingTypeStruct:
case YYEncodingTypeUnion: {
@try {
NSValue *value = [self valueForKey:NSStringFromSelector(propertyMeta->_getter)];
if (value) {
[one setValue:value forKey:propertyMeta->_name];
}
} @catch (NSException *exception) {}
} // break; commented for code coverage in next line
default: break;
}
}
}
return one;
}

8.

 - (void)yy_modelEncodeWithCoder:(NSCoder *)aCoder {
if (!aCoder) return;
if (self == (id)kCFNull) {
[((id<NSCoding>)self)encodeWithCoder:aCoder];
return;
} _YYModelMeta *modelMeta = [_YYModelMeta metaWithClass:self.class];
if (modelMeta->_nsType) {
[((id<NSCoding>)self)encodeWithCoder:aCoder];
return;
} for (_YYModelPropertyMeta *propertyMeta in modelMeta->_allPropertyMetas) {
if (!propertyMeta->_getter) return; if (propertyMeta->_isCNumber) {
NSNumber *value = ModelCreateNumberFromProperty(self, propertyMeta);
if (value) [aCoder encodeObject:value forKey:propertyMeta->_name];
} else {
switch (propertyMeta->_type & YYEncodingTypeMask) {
case YYEncodingTypeObject: {
id value = ((id (*)(id, SEL))(void *)objc_msgSend)((id)self, propertyMeta->_getter);
if (value && (propertyMeta->_nsType || [value respondsToSelector:@selector(encodeWithCoder:)])) {
if ([value isKindOfClass:[NSValue class]]) {
if ([value isKindOfClass:[NSNumber class]]) {
[aCoder encodeObject:value forKey:propertyMeta->_name];
}
} else {
[aCoder encodeObject:value forKey:propertyMeta->_name];
}
}
} break;
case YYEncodingTypeSEL: {
SEL value = ((SEL (*)(id, SEL))(void *)objc_msgSend)((id)self, propertyMeta->_getter);
if (value) {
NSString *str = NSStringFromSelector(value);
[aCoder encodeObject:str forKey:propertyMeta->_name];
}
} break;
case YYEncodingTypeStruct:
case YYEncodingTypeUnion: {
if (propertyMeta->_isKVCCompatible && propertyMeta->_isStructAvailableForKeyedArchiver) {
@try {
NSValue *value = [self valueForKey:NSStringFromSelector(propertyMeta->_getter)];
[aCoder encodeObject:value forKey:propertyMeta->_name];
} @catch (NSException *exception) {}
}
} break; default:
break;
}
}
}
} - (id)yy_modelInitWithCoder:(NSCoder *)aDecoder {
if (!aDecoder) return self;
if (self == (id)kCFNull) return self;
_YYModelMeta *modelMeta = [_YYModelMeta metaWithClass:self.class];
if (modelMeta->_nsType) return self; for (_YYModelPropertyMeta *propertyMeta in modelMeta->_allPropertyMetas) {
if (!propertyMeta->_setter) continue; if (propertyMeta->_isCNumber) {
NSNumber *value = [aDecoder decodeObjectForKey:propertyMeta->_name];
if ([value isKindOfClass:[NSNumber class]]) {
ModelSetNumberToProperty(self, value, propertyMeta);
[value class];
}
} else {
YYEncodingType type = propertyMeta->_type & YYEncodingTypeMask;
switch (type) {
case YYEncodingTypeObject: {
id value = [aDecoder decodeObjectForKey:propertyMeta->_name];
((void (*)(id, SEL, id))(void *) objc_msgSend)((id)self, propertyMeta->_setter, value);
} break;
case YYEncodingTypeSEL: {
NSString *str = [aDecoder decodeObjectForKey:propertyMeta->_name];
if ([str isKindOfClass:[NSString class]]) {
SEL sel = NSSelectorFromString(str);
((void (*)(id, SEL, SEL))(void *) objc_msgSend)((id)self, propertyMeta->_setter, sel);
}
} break;
case YYEncodingTypeStruct:
case YYEncodingTypeUnion: {
if (propertyMeta->_isKVCCompatible) {
@try {
NSValue *value = [aDecoder decodeObjectForKey:propertyMeta->_name];
if (value) [self setValue:value forKey:propertyMeta->_name];
} @catch (NSException *exception) {}
}
} break; default:
break;
}
}
}
return self;
}

9.

 - (NSUInteger)yy_modelHash {
if (self == (id)kCFNull) return [self hash];
_YYModelMeta *modelMeta = [_YYModelMeta metaWithClass:self.class];
if (modelMeta->_nsType) return [self hash]; NSUInteger value = ;
NSUInteger count = ;
for (_YYModelPropertyMeta *propertyMeta in modelMeta->_allPropertyMetas) {
if (!propertyMeta->_isKVCCompatible) continue;
value ^= [[self valueForKey:NSStringFromSelector(propertyMeta->_getter)] hash];
count++;
}
if (count == ) value = (long)((__bridge void *)self);
return value;
}

10.

 /**
* 比较是否相等
* 比较的规则是:
1. 直接使用==比较 相同则返回YES
2. 使用isMemberOfClass方法,
3. 如果是nsType 使用isEqual 比较
4. 使用hash比较
5. 便利模型中的全部属性,判断是否支持KVC 在判断属性是否完全相等
*/
- (BOOL)yy_modelIsEqual:(id)model {
if (self == model) return YES;
if (![model isMemberOfClass:self.class]) return NO;
_YYModelMeta *modelMeta = [_YYModelMeta metaWithClass:self.class];
if (modelMeta->_nsType) return [self isEqual:model];
if ([self hash] != [model hash]) return NO; for (_YYModelPropertyMeta *propertyMeta in modelMeta->_allPropertyMetas) {
if (!propertyMeta->_isKVCCompatible) continue;
id this = [self valueForKey:NSStringFromSelector(propertyMeta->_getter)];
id that = [model valueForKey:NSStringFromSelector(propertyMeta->_getter)];
if (this == that) continue;
if (this == nil || that == nil) return NO;
if (![this isEqual:that]) return NO;
}
return YES;
}

11.

 - (NSString *)yy_modelDescription {
return ModelDescription(self);
}

下边的是一些对NSArray / NSDictionary 的分类

把json 转为 NSArray 里边装着cls类型的转好模型的数据

 @implementation NSArray (YYModel)

 + (NSArray *)yy_modelArrayWithClass:(Class)cls json:(id)json {
if (!json) return nil;
NSArray *arr = nil;
NSData *jsonData = nil;
if ([json isKindOfClass:[NSArray class]]) {
arr = json;
} else if ([json isKindOfClass:[NSString class]]) {
jsonData = [(NSString *)json dataUsingEncoding : NSUTF8StringEncoding];
} else if ([json isKindOfClass:[NSData class]]) {
jsonData = json;
}
if (jsonData) {
arr = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:NULL];
if (![arr isKindOfClass:[NSArray class]]) arr = nil;
}
return [self yy_modelArrayWithClass:cls array:arr];
} + (NSArray *)yy_modelArrayWithClass:(Class)cls array:(NSArray *)arr {
if (!cls || !arr) return nil;
NSMutableArray *result = [NSMutableArray new];
for (NSDictionary *dic in arr) {
if (![dic isKindOfClass:[NSDictionary class]]) continue;
NSObject *obj = [cls yy_modelWithDictionary:dic];
if (obj) [result addObject:obj];
}
return result;
} @end

把字典中的value转为cls模型后使用字典的key保存为一个新的字典后返回

 @implementation NSDictionary (YYModel)

 + (NSDictionary *)yy_modelDictionaryWithClass:(Class)cls json:(id)json {
if (!json) return nil;
NSDictionary *dic = nil;
NSData *jsonData = nil;
if ([json isKindOfClass:[NSDictionary class]]) {
dic = json;
} else if ([json isKindOfClass:[NSString class]]) {
jsonData = [(NSString *)json dataUsingEncoding : NSUTF8StringEncoding];
} else if ([json isKindOfClass:[NSData class]]) {
jsonData = json;
}
if (jsonData) {
dic = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:NULL];
if (![dic isKindOfClass:[NSDictionary class]]) dic = nil;
}
return [self yy_modelDictionaryWithClass:cls dictionary:dic];
} + (NSDictionary *)yy_modelDictionaryWithClass:(Class)cls dictionary:(NSDictionary *)dic {
if (!cls || !dic) return nil;
NSMutableDictionary *result = [NSMutableDictionary new];
for (NSString *key in dic.allKeys) {
if (![key isKindOfClass:[NSString class]]) continue;
NSObject *obj = [cls yy_modelWithDictionary:dic[key]];
if (obj) result[key] = obj;
}
return result;
} @end

YYModel 源码解读(二)之NSObject+YYModel.h (5)的更多相关文章

  1. YYModel 源码解读(二)之NSObject+YYModel.h (1)

    本篇文章主要介绍 _YYModelPropertyMeta 前边的内容 首先先解释一下前边的辅助函数和枚举变量,在写一个功能的时候,这些辅助的东西可能不是一开始就能想出来的,应该是在后续的编码过程中 ...

  2. jQuery.Callbacks 源码解读二

    一.参数标记 /* * once: 确保回调列表仅只fire一次 * unique: 在执行add操作中,确保回调列表中不存在重复的回调 * stopOnFalse: 当执行回调返回值为false,则 ...

  3. (转)go语言nsq源码解读二 nsqlookupd、nsqd与nsqadmin

    转自:http://www.baiyuxiong.com/?p=886 ---------------------------------------------------------------- ...

  4. YYModel 源码解读(二)之YYClassInfo.h (3)

    前边3篇介绍了YYClassinfo 文件的组成单元,算是功能的分割,按照业务的设计思想来说,方向应该是相反的 由此引申出我们在设计api的思想其实和项目管理是很类似的----- 一些题外话 1.目的 ...

  5. YYModel 源码解读 总结

    在使用swfit写代码的过程中,使用了下oc写的字典转模型,发现有些属性转不成功,就萌生了阅读源码的想法. 其实一直都知道Runtime机制,但并没有系统的学习,可能是因为平时的使用比较少,无意间在g ...

  6. YYModel 源码解读(一)之YYModel.h

    #if __has_include(<YYModel/YYModel.h>) FOUNDATION_EXPORT double YYModelVersionNumber; FOUNDATI ...

  7. mybatis源码解读(二)——构建Configuration对象

    Configuration 对象保存了所有mybatis的配置信息,主要包括: ①. mybatis-configuration.xml 基础配置文件 ②. mapper.xml 映射器配置文件 1. ...

  8. ConcurrentHashMap源码解读二

    接下来就讲解put里面的三个方法,分别是 1.数组初始化方法initTable() 2.线程协助扩容方法helpTransfer() 3.计数方法addCount() 首先是数组初始化,再将源码之前, ...

  9. go语言nsq源码解读二 nsqlookupd、nsqd与nsqadmin

    nsqlookupd: 官方文档解释见:http://bitly.github.io/nsq/components/nsqlookupd.html 用官方话来讲是:nsqlookupd管理拓扑信息,客 ...

  10. vue2.0 源码解读(二)

    小伞最近比较忙,阅读源码的速度越来越慢了 最近和朋友交流的时候,发现他们对于源码的目录结构都不是很清楚 红色圈子内是我们需要关心的地方 compiler  模板编译部分 core 核心实现部分 ent ...

随机推荐

  1. Jexus 5.8.2 正式发布为Asp.Net Core进入生产环境提供平台支持

    Jexus 是一款运行于 Linux 平台,以支持  ASP.NET.PHP 为特色的集高安全性和高性能为一体的 WEB 服务器和反向代理服务器.最新版 5.8.2 已经发布,有如下更新: 1,现在大 ...

  2. 简单入门canvas - 通过刮奖效果来学习

    一 .前言 一直在做PC端的前端开发,从互联网到行业软件.最近发现移动端已经成为前端必备技能了,真是不能停止学习.HTML5新增的一些东西,canvas是用的比较多也比较复杂的一个,简单的入门了一下, ...

  3. SQL Server内存遭遇操作系统进程压榨案例

    场景: 最近一台DB服务器偶尔出现CPU报警,我的邮件报警阈(请读yù)值设置的是15%,开始时没当回事,以为是有什么统计类的查询,后来越来越频繁. 探索: 我决定来查一下,究竟是什么在作怪,我排查的 ...

  4. SSH实战 · 唯唯乐购项目(中)

    用户模块 三:一级分类的查询 创建一级分类表并导入基本数据 CREATE TABLE `category` (   `cid` int(11) NOT NULL AUTO_INCREMENT,   ` ...

  5. MSDN文档篇

    很多人网上下载3~10G不等的MSDN文档,发现,下载完成了不会用 很多人每次都得在线下载文档,手上万千PC,都重新下载不是得疯了? so==> 先看几张图 推荐一个工具:https://vsh ...

  6. 很多人很想知道怎么扫一扫二维码就能打开网站,就能添加联系人,就能链接wifi,今天说下这些格式,明天做个demo

    有些功能部分手机不能使用,网站,通讯录,wifi基本上每个手机都可以使用. 在看之前你可以扫一扫下面几个二维码先看看效果: 1.二维码生成 网址 (URL) 包含网址的 二维码生成 是大家平时最常接触 ...

  7. C#多线程之线程池篇2

    在上一篇C#多线程之线程池篇1中,我们主要学习了如何在线程池中调用委托以及如何在线程池中执行异步操作,在这篇中,我们将学习线程池和并行度.实现取消选项的相关知识. 三.线程池和并行度 在这一小节中,我 ...

  8. notepad++设置默认打开txt文件失效的解决方法

    1.系统环境 win10企业版,64位系统 2.初步设置 设置txt默认为notepad++打开,菜单:设置->首选项->文件关联 选择对应的文件扩展,点击"关闭"按钮 ...

  9. 推荐一个ASP.NET网站内容管理系统源码

    许多人都有各自的兴趣,如打球.踢毽子.看书.看电视.玩游戏等等....我近来迷上了猜灯谜,于是业余做了一个在线猜灯谜的网站:何问起谜语. 先出个谜语让你猜猜:不可缺一点(打一字).可以在线猜:http ...

  10. SqlServer简单数据分页

    手边开发的后端项目一直以来都用的.NET MVC框架,访问数据库使用其自带的EF CodeFirst模式,写存储过程的能力都快退化了 闲来无事,自己写了条分页存储过程,网上类似的文章多的是,这里只列了 ...