热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Newtonsoft.JsonC#Json序列化和反序列化工具的使用、类型方法大全

Newtonsoft.JsonNewtonsoft.Json是.Net平台操作Json的工具,他的介绍就不多说了,笔者最近在弄接口,需要操作Json。以某个云计算平台的Token为例,边操

 Newtonsoft.Json

Newtonsoft.Json 是.Net平台操作Json的工具,他的介绍就不多说了,笔者最近在弄接口,需要操作Json。

以某个云计算平台的Token为例,边操作边讲解。

Json 转为 Model

将 Model 转为 Json

将 LINQ 转为 JSON

Linq 操作

命名空间、类型、方法大全

另外附上 百度AI 文字识别 Json 及其模型类


 

 

 Newtonsoft.Json 将字符串转为对象,是根据类型对象名称进行的,大小写不分,但是名称要一致要,哪怕你的json只有一个

{

"a":1

}

你的对象

public class Test
    {
        public int aa{get;set;}
    }

也是不能对应的。

有复杂层次的 json,可以使用 “类中类” 来映射,要注意 List/Array/ArrayList的类型的使用。


 Json 转为 Model

 

新建一个 Json 文件,名字随意,例如 json1.json

把以下内容粘贴进去

{
  "refresh_token": "25.ea2f85ebd48df85fe5400000.18640.282335-15533349",
  "expires_in": 2592010,
  "session_key": "9mzdWr3n8ncMeDgX8zjhkhlW8khb5cdZtPevPbPwQGBg==",
  "access_token": "24.ac0ca9fakhlkyhl552017858.282335-15533349",
  "scope": "audio_voice_assistant_get audio_tts_post public vis-ocr_ocr nlp_simnet nlp_wclassify_watermark brain_ocr_scope vis-classify_car brain_gif_antiporn brain_ocr_general brain_ocr_general_basic brain_ocr_generer vis-classify_animal brain_politician brain_unit_utterance brain_imgquality_general brain_nlp_simnet brain_nlp_depparser vis-classify_plant brain_solution brain_ocr_plate_number brain_nlp_wordembedding brain_nlp_dnnlm_cn_legacy brain_nlp_simnet_legacy brain_nlp_commain_animal_classify brain_plant_classify brain_solution_iocr brain_realtime_product brain_nlp_lexer_custom brain_kgbody_analysis brain_body_attr brain_ocr_vat_invoice brain_advanced_general_classify brain_numbers brain_body_number vis-faceverify_FACE_auth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi",
  "session_secret": "2ca66d464545c77a4767f709873be4"
}

 

定义一个模型,文件名为 AccessTokenModel.cs

    public class AccessTokenModel
    {
        public string refresh_token { get; set; }
        public string expires_in { get; set; }//: Access Token的有效期(秒为单位,一般为1个月)
        public string scope { get; set; }
        public string session_key { get; set; }
        public string access_token { get; set; }//: 要获取的Access Token
        public string session_secret { get; set; }
    }

打开 Program.cs 文件

            public static void Main(string[] args)
            {
                FileStream fs = new FileStream(@"请修改成你的文件路径\json1.json", FileMode.Open);
                StreamReader fileStream = new StreamReader(fs);
                string str = "";
                string line;
                while ((line = fileStream.ReadLine()) != null)
                {
                    str += line;
                }
          //上面的代码没有意义,只是将Json文件的内容加载到字符串中
           JObject jObject
= new JObject();        //新建 操作对象 AccessTokenModel a = JsonConvert.DeserializeObject(str); Console.WriteLine(a.access_token);    //随意输出一个属性 Console.ReadKey(); }

 重点方法 

JsonConvert.DeserializeObject<要转化的模型类>("字符串对象");

之后可以很方便的把Json文件的内容存放到数据库中。

集合

把Json文件改成以下的样子

[{
  "refresh_token": "25.ea2f85ebd48df85fe5400000.18640.282335-15533349",
  "expires_in": 2592010,
  "session_key": "9mzdWr3n8ncMeDgX8zjhkhlW8khb5cdZtPevPbPwQGBg==",
  "access_token": "24.ac0ca9fakhlkyhl552017858.282335-15533349",
  "scope": "audio_voice_assistant_get audio_tts_post public vis-ocr_ocr nlp_simnet nlp_wclassify_watermark brain_ocr_scope vis-classify_car brain_gif_antiporn brain_ocr_general brain_ocr_general_basic brain_ocr_generer vis-classify_animal brain_politician brain_unit_utterance brain_imgquality_general brain_nlp_simnet brain_nlp_depparser vis-classify_plant brain_solution brain_ocr_plate_number brain_nlp_wordembedding brain_nlp_dnnlm_cn_legacy brain_nlp_simnet_legacy brain_nlp_commain_animal_classify brain_plant_classify brain_solution_iocr brain_realtime_product brain_nlp_lexer_custom brain_kgbody_analysis brain_body_attr brain_ocr_vat_invoice brain_advanced_general_classify brain_numbers brain_body_number vis-faceverify_FACE_auth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi",
  "session_secret": "2ca66d464545c77a4767f709873be4"
},
{
  "refresh_token": "25.ea2f85ebd48df85fe5400000.18640.282335-15533349",
  "expires_in": 2592010,
  "session_key": "9mzdWr3n8ncMeDgX8zjhkhlW8khb5cdZtPevPbPwQGBg==",
  "access_token": "24.ac0ca9fakhlkyhl552017858.282335-15533349",
  "scope": "audio_voice_assistant_get audio_tts_post public vis-ocr_ocr nlp_simnet nlp_wclassify_watermark brain_ocr_scope vis-classify_car brain_gif_antiporn brain_ocr_general brain_ocr_general_basic brain_ocr_generer vis-classify_animal brain_politician brain_unit_utterance brain_imgquality_general brain_nlp_simnet brain_nlp_depparser vis-classify_plant brain_solution brain_ocr_plate_number brain_nlp_wordembedding brain_nlp_dnnlm_cn_legacy brain_nlp_simnet_legacy brain_nlp_commain_animal_classify brain_plant_classify brain_solution_iocr brain_realtime_product brain_nlp_lexer_custom brain_kgbody_analysis brain_body_attr brain_ocr_vat_invoice brain_advanced_general_classify brain_numbers brain_body_number vis-faceverify_FACE_auth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi",
  "session_secret": "2ca66d464545c77a4767f709873be4"
}
]

 

            public static void Main(string[] args)
            {
                FileStream fs = new FileStream(@"请修改成你的文件路径\json1.json", FileMode.Open);
                StreamReader fileStream = new StreamReader(fs);
                string str = "";
                string line;
                while ((line = fileStream.ReadLine()) != null)
                {
                    str += line;
                }
                //上面的代码没有意义,只是将Json文件的内容加载到字符串中

                JObject jObject = new JObject();        //新建 操作对象
                List a = JsonConvert.DeserializeObject>(str);
                foreach (var i in a)
                {
                    Console.WriteLine(i.access_token);
                }

                Console.ReadKey();
            }

 


将Model转为Json

能够将模型对象转为 Json。

继续使用上面的 AccessTokenModel.cs 文件,

            public static void Main(string[] args)
            {
                AccessTokenModel accessTokenModel = new AccessTokenModel();
                accessTokenModel.access_token = "test1";
                accessTokenModel.expires_in = "test2";
                accessTokenModel.refresh_token = "test3";
                accessTokenModel.scope = "test4";
                accessTokenModel.session_key = "test5";
                accessTokenModel.session_secret = "test6";

                JObject jObject = new JObject();
                string str = JsonConvert.SerializeObject(accessTokenModel);    //转为字符串

                Console.WriteLine(str);
                Console.ReadKey();
            }

重点方法 

JsonConvert.SerializeObject(a模型对象);

运行后可以看到控制台输出的是Json字符串了,你可以继续把他放到Json文件中,这里不再赘述。


将 LINQ 转为 JSON

下面这个是从官网直接copy的例子,Jarray 是其框架提供的一种类型。

在控制台运行后会发现输出的字符是已经格式化的。

            public static void Main(string[] args)
            {
                JArray array = new JArray();
                array.Add("Manual text");
                array.Add(new DateTime(2000, 5, 23));

                JObject o = new JObject();
                o["MyArray"] = array;

                string json = o.ToString();
                // {
                //   "MyArray": [
                //     "Manual text",
                //     "2000-05-23T00:00:00"
                //   ]
                // }

                Console.WriteLine(json);
                Console.ReadKey();

 


Linq 操作

框架提供了对 Jobject 对象的Linq操作支持

using Newtonsoft.Json.Linq;

之后你可以像操作数组、集合或者Context一样方便。

 


命名空间、类型、方法大全

本来想翻译一下的,英语太差,算了。在常用的类型前面加粗吧

 

Classes
  Class Description
Public class DefaultJsonNameTable
The default JSON name table implementation.
Public class JsonArrayAttribute
Instructs the  JsonSerializer how to serialize the collection.
Public class JsonConstructorAttribute
Instructs the  JsonSerializer to use the specified constructor when deserializing that object.
Public class JsonContainerAttribute
Instructs the  JsonSerializer how to serialize the object.
Public classCode example JsonConvert
提供用于在.NET 和 Json之间互相转等操作的方法
Public class JsonConverter
Converts an object to and from JSON.
Public class JsonConverter>
Converts an object to and from JSON.
Public class JsonConverterAttribute
Instructs the  JsonSerializer to use the specified  JsonConverter when serializing the member or class.
Public class JsonConverterCollection
Represents a collection of  JsonConverter.
Public class JsonDictionaryAttribute
Instructs the  JsonSerializer how to serialize the collection.
Public class JsonException
JSON序列化或反序列化过程中发生错误时引发的异常类型
Public class JsonExtensionDataAttribute
Instructs the  JsonSerializer to deserialize properties with no matching class member into the specified collection and write values during serialization.
Public class JsonIgnoreAttribute
Instructs the  JsonSerializer not to serialize the public field or public read/write property value.
Public class JsonNameTable
Base class for a table of atomized string objects.
Public class JsonObjectAttribute
Instructs the  JsonSerializer how to serialize the object.
Public class JsonPropertyAttribute
Instructs the  JsonSerializer to always serialize the member with the specified name.
Public class JsonReader
Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data.
Public class JsonReaderException
The exception thrown when an error occurs while reading JSON text.
Public class JsonRequiredAttribute
Instructs the  JsonSerializer to always serialize the member, and to require that the member has a value.
Public class JsonSerializationException
The exception thrown when an error occurs during JSON serialization or deserialization.
Public class JsonSerializer
Serializes and deserializes objects into and from the JSON format. The  JsonSerializer enables you to control how objects are encoded into JSON.
Public class JsonSerializerSettings
Specifies the settings on a  JsonSerializer object.
Public class JsonTextReader
Represents a reader that provides fast, non-cached, forward-only access to JSON text data.
Public class JsonTextWriter
Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
Public class JsonValidatingReader Obsolete.

Represents a reader that provides JsonSchema validation.

Caution note Caution
JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschemafor more details.
Public class JsonWriter
Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
Public class JsonWriterException
The exception thrown when an error occurs while writing JSON text.
Interfaces
  Interface Description
Public interface IArrayPool>
Provides an interface for using pooled arrays.
Public interface IJsonLineInfo
Provides an interface to enable a class to return line and position information.
Enumerations
  Enumeration Description
Public enumeration ConstructorHandling
Specifies how constructors are used when initializing objects during deserialization by the  JsonSerializer.
Public enumeration DateFormatHandling
Specifies how dates are formatted when writing JSON text.
Public enumeration DateParseHandling
Specifies how date formatted strings, e.g.  "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON text.
Public enumeration DateTimeZoneHandling
Specifies how to treat the time value when converting between string and  DateTime.
Public enumerationCode example DefaultValueHandling
Specifies default value handling options for the  JsonSerializer.
Public enumeration FloatFormatHandling
Specifies float format handling options when writing special floating point numbers, e.g.  NaN, PositiveInfinity and  NegativeInfinity with  JsonWriter.
Public enumeration FloatParseHandling
Specifies how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
Public enumeration Formatting
Specifies formatting options for the  JsonTextWriter.
Protected enumeration JsonReader.State
Specifies the state of the reader.
Public enumeration JsonToken
Specifies the type of JSON token.
Public enumeration MemberSerialization
Specifies the member serialization options for the  JsonSerializer.
Public enumeration MetadataPropertyHandling
Specifies metadata property handling options for the  JsonSerializer.
Public enumeration MissingMemberHandling
Specifies missing member handling options for the  JsonSerializer.
Public enumerationCode example NullValueHandling
Specifies null value handling options for the  JsonSerializer.
Public enumeration ObjectCreationHandling
Specifies how object creation is handled by the  JsonSerializer.
Public enumerationCode example PreserveReferencesHandling
Specifies reference handling options for the  JsonSerializer. Note that references cannot be preserved when a value is set via a non-default constructor such as types that implement  ISerializable.
Public enumeration ReferenceLoopHandling
Specifies reference loop handling options for the  JsonSerializer.
Public enumeration Required
Indicating whether a property is required.
Public enumeration StringEscapeHandling
Specifies how strings are escaped when writing JSON text.
Public enumeration TypeNameAssemblyFormatHandling
Indicates the method that will be used during deserialization for locating and loading assemblies.
Public enumeration TypeNameHandling
Specifies type name handling options for the  JsonSerializer.
Public enumeration WriteState
Specifies the state of the  JsonWriter.
 

另外附上 百度AI 文字识别 Json 及其模型类

 图片

笔者在弄了一段时间的百度 Ai 平台的SDK,封装了OCR SDK,由于现在在找实习工作,所以有部分没有弄完,有兴趣可以添加笔者的微信免费获取。微信在右侧导航栏。

百度AI 识别文字,返回Json结果, 名字随意.格式建议为 json,如果使用记事本保存,注意编码格式是 utf-8,因为c# string默认为utf8,不然会乱码。

{
  "log_id": 3413661945235258919,
  "direction": 0,
  "words_result_num": 2,
  "words_result": [
    {
      "vertexes_location": [
        {
          "y": 81,
          "x": 51
        },
        {
          "y": 81,
          "x": 151
        },
        {
          "y": 103,
          "x": 151
        },
        {
          "y": 103,
          "x": 51
        }
      ],
      "probability": {
        "variance": 0.0,
        "average": 0.999861,
        "min": 0.999627
      },
      "chars": [
        {
          "char": "今",
          "location": {
            "width": 17,
            "top": 83,
            "left": 60,
            "height": 20
          }
        },
        {
          "char": "天",
          "location": {
            "width": 17,
            "top": 83,
            "left": 78,
            "height": 20
          }
        },
        {
          "char": "除",
          "location": {
            "width": 12,
            "top": 83,
            "left": 103,
            "height": 20
          }
        },
        {
          "char": "了",
          "location": {
            "width": 16,
            "top": 83,
            "left": 116,
            "height": 20
          }
        },
        {
          "char": "皮",
          "location": {
            "width": 13,
            "top": 83,
            "left": 140,
            "height": 20
          }
        }
      ],
      "min_finegrained_vertexes_location": [
        {
          "y": 81,
          "x": 51
        },
        {
          "y": 81,
          "x": 151
        },
        {
          "y": 103,
          "x": 151
        },
        {
          "y": 103,
          "x": 51
        }
      ],
      "finegrained_vertexes_location": [
        {
          "y": 81,
          "x": 51
        },
        {
          "y": 81,
          "x": 71
        },
        {
          "y": 81,
          "x": 90
        },
        {
          "y": 81,
          "x": 110
        },
        {
          "y": 81,
          "x": 129
        },
        {
          "y": 81,
          "x": 149
        },
        {
          "y": 81,
          "x": 151
        },
        {
          "y": 91,
          "x": 151
        },
        {
          "y": 100,
          "x": 151
        },
        {
          "y": 103,
          "x": 151
        },
        {
          "y": 103,
          "x": 132
        },
        {
          "y": 103,
          "x": 112
        },
        {
          "y": 103,
          "x": 93
        },
        {
          "y": 103,
          "x": 73
        },
        {
          "y": 103,
          "x": 54
        },
        {
          "y": 103,
          "x": 51
        },
        {
          "y": 93,
          "x": 51
        },
        {
          "y": 84,
          "x": 51
        }
      ],
      "location": {
        "width": 102,
        "top": 81,
        "left": 51,
        "height": 24
      },
      "words": "今天除了皮"
    },
    {
      "vertexes_location": [
        {
          "y": 109,
          "x": 52
        },
        {
          "y": 109,
          "x": 152
        },
        {
          "y": 130,
          "x": 152
        },
        {
          "y": 130,
          "x": 52
        }
      ],
      "probability": {
        "variance": 8E-05,
        "average": 0.9907,
        "min": 0.973259
      },
      "chars": [
        {
          "char": "又",
          "location": {
            "width": 16,
            "top": 111,
            "left": 61,
            "height": 20
          }
        },
        {
          "char": "啥",
          "location": {
            "width": 12,
            "top": 111,
            "left": 85,
            "height": 20
          }
        },
        {
          "char": "也",
          "location": {
            "width": 16,
            "top": 111,
            "left": 98,
            "height": 20
          }
        },
        {
          "char": "没",
          "location": {
            "width": 15,
            "top": 111,
            "left": 123,
            "height": 20
          }
        },
        {
          "char": "干",
          "location": {
            "width": 13,
            "top": 111,
            "left": 141,
            "height": 20
          }
        }
      ],
      "min_finegrained_vertexes_location": [
        {
          "y": 109,
          "x": 52
        },
        {
          "y": 109,
          "x": 152
        },
        {
          "y": 130,
          "x": 152
        },
        {
          "y": 130,
          "x": 52
        }
      ],
      "finegrained_vertexes_location": [
        {
          "y": 109,
          "x": 52
        },
        {
          "y": 109,
          "x": 71
        },
        {
          "y": 109,
          "x": 91
        },
        {
          "y": 109,
          "x": 110
        },
        {
          "y": 109,
          "x": 129
        },
        {
          "y": 109,
          "x": 149
        },
        {
          "y": 109,
          "x": 152
        },
        {
          "y": 119,
          "x": 152
        },
        {
          "y": 129,
          "x": 152
        },
        {
          "y": 130,
          "x": 152
        },
        {
          "y": 130,
          "x": 133
        },
        {
          "y": 130,
          "x": 113
        },
        {
          "y": 130,
          "x": 94
        },
        {
          "y": 130,
          "x": 74
        },
        {
          "y": 130,
          "x": 55
        },
        {
          "y": 130,
          "x": 52
        },
        {
          "y": 121,
          "x": 52
        },
        {
          "y": 111,
          "x": 52
        }
      ],
      "location": {
        "width": 102,
        "top": 109,
        "left": 52,
        "height": 22
      },
      "words": "又啥也没干"
    }
  ],
  "language": -1
}

对应的模型 ,将 cs 文件,名字  GeneralModel.cs

    /// 
    /// 通用文字识别(含位置版)返回结果
    /// 
    public class GeneralModel
    {
        /// 
        /// 必选
        /// 唯一的log id,用于问题定位
        /// 
        public long log_id { get; set; }
        /// 
        /// 图像方向,当detect_direction=true时存在。
        /// 非必选
        ///- -1:未定义,
        ///- 0:正向,
        ///- 1: 逆时针90度,
        ///- 2:逆时针180度,
        ///- 3:逆时针270度
        /// 
        public int direction { get; set; }

        /// 
        /// 必选
        /// 识别结果数,表示words_result的元素个数
        /// 
        public int words_result_num { get; set; }

        /// 
        /// 检测语言 默认值会返回 -1
        /// 
        public string language { get; set; }
        /// 
        /// 定位和识别文字结果数组
        /// 
        public List words_result { get; set; }

        public class Words_result
        {
            /// 
            /// 图片中文字段四个顶点位置(矩形范围)
            /// 
            public List vertexes_Location { get; set; }
            /// 
            /// 可选
            /// 行置信度信息;如果输入参数 probability = true 则输出
            /// 
            public Probability probability { get; set; }
            /// 
            /// 每个字
            /// 
            public List chars { get; set; }
            /// 
            /// 最小细粒度顶点坐标
            /// 
            public List min_finegrained_vertexes_location { get; set; }
            /// 
            /// 细粒度顶点坐标,多边形
            /// 
            public List finegrained_vertexes_location { get; set; }
            /// 
            /// 文字在图片中的相对位置
            /// 
            public Location location { get; set; }
            /// 
            /// 识别出的文字
            /// 
            public string words { get; set; }
            /// 
            /// 坐标
            /// 
            public class XY
            {
                public int x { get; set; }
                public int y { get; set; }
            }
            /// 
            /// 行置信度
            /// 
            public class Probability
            {
                /// 
                /// 行置信度平均值方差
                /// 
                public double variance { get; set; }
                /// 
                /// 行置信度平均值
                /// 
                public double average { get; set; }

                /// 
                /// 行置信度最小值
                /// 
                public double min { get; set; }
            }
            /// 
            /// 单个文字
            /// 
            public class Chars
            {
                /// 
                /// 识别的单个文字
                /// 
                public char chaR { get; set; }
                /// 
                /// 该文字范围(矩形)
                /// 
                public Location location { get; set; }
            }
        }
        public class Location
        {
            public int left { get; set; }
            public int top { get; set; }
            public int width { get; set; }
            public int height { get; set; }
        }
    }
}

可用控制台进行检验

 static void Main(string[] args)
        {
            StreamReader streamReader = new StreamReader(System.IO.File.OpenRead(@"json文件位置"));
            string str = "";
            string jsonstr;
            while ((jsOnstr= streamReader.ReadLine()) != null)
            {
                str += jsonstr;
            }

            GeneralModel generalModel = JsonConvert.DeserializeObject(str);

            Console.WriteLine("图片id:" + generalModel.log_id);
            Console.WriteLine("图像方向:" + generalModel.direction);
            Console.WriteLine("检测语言为:" + generalModel.language);
            Console.WriteLine("有几个结果:" + generalModel.words_result_num);

            foreach (var item in generalModel.words_result)
            {

                Console.WriteLine("识别结果:" + Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(item.words)));
                foreach (var itemi in item.vertexes_Location)
                {
                    Console.WriteLine("{x:" + itemi.x + ";y:" + itemi.y + "}");
                }
                Console.WriteLine("Probability:可信度:" + "行置信度平均值" + item.probability.average + ";行置信度平均值方差:" + item.probability.variance + ";行置信度平均值最小值:" + item.probability.min);
                foreach (var itemi in item.chars)
                {
                    Console.WriteLine(itemi.chaR);
                    Console.WriteLine("位置:  left:" + itemi.location.left + ";  height: " + itemi.location.height + "top: " + itemi.location.top + "; width: " + itemi.location.width);
                }
            }

            Console.ReadKey();

 


推荐阅读
  • Python实现变声器功能(萝莉音御姐音)的方法及步骤
    本文介绍了使用Python实现变声器功能(萝莉音御姐音)的方法及步骤。首先登录百度AL开发平台,选择语音合成,创建应用并填写应用信息,获取Appid、API Key和Secret Key。然后安装pythonsdk,可以通过pip install baidu-aip或python setup.py install进行安装。最后,书写代码实现变声器功能,使用AipSpeech库进行语音合成,可以设置音量等参数。 ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • 本文讨论了在Windows 8上安装gvim中插件时出现的错误加载问题。作者将EasyMotion插件放在了正确的位置,但加载时却出现了错误。作者提供了下载链接和之前放置插件的位置,并列出了出现的错误信息。 ... [详细]
  • 本文介绍了Redis的基础数据结构string的应用场景,并以面试的形式进行问答讲解,帮助读者更好地理解和应用Redis。同时,描述了一位面试者的心理状态和面试官的行为。 ... [详细]
  • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
    本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • 计算机存储系统的层次结构及其优势
    本文介绍了计算机存储系统的层次结构,包括高速缓存、主存储器和辅助存储器三个层次。通过分层存储数据可以提高程序的执行效率。计算机存储系统的层次结构将各种不同存储容量、存取速度和价格的存储器有机组合成整体,形成可寻址存储空间比主存储器空间大得多的存储整体。由于辅助存储器容量大、价格低,使得整体存储系统的平均价格降低。同时,高速缓存的存取速度可以和CPU的工作速度相匹配,进一步提高程序执行效率。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 本文详细介绍了GetModuleFileName函数的用法,该函数可以用于获取当前模块所在的路径,方便进行文件操作和读取配置信息。文章通过示例代码和详细的解释,帮助读者理解和使用该函数。同时,还提供了相关的API函数声明和说明。 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文介绍了C#中生成随机数的三种方法,并分析了其中存在的问题。首先介绍了使用Random类生成随机数的默认方法,但在高并发情况下可能会出现重复的情况。接着通过循环生成了一系列随机数,进一步突显了这个问题。文章指出,随机数生成在任何编程语言中都是必备的功能,但Random类生成的随机数并不可靠。最后,提出了需要寻找其他可靠的随机数生成方法的建议。 ... [详细]
author-avatar
齐老大2502895835
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有