In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "what are the methods of calling API in C#". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "what are the methods of calling API in C#".
Introduction
API (Application Programming Interface), I think you are no stranger, it is a regular guest of our Windows programming, although C # based on .net platform has a powerful class library, but we still can not deny the importance of API in Windows programming. Most programming languages support API programming, but the MFC (Microsoft Foundation Class Library) framework in .net platform encapsulates most of API.
As programmers, we need to understand that API literally means programming interface, so as developers, all we need to know is how to use API.
API specific to the operating system:
Each operating system has many general-purpose API and some special API, these special API can only be executed in the current operating system.
Mode 1 / / the QR code string CodeMsg = HttpPost for parsing scanning through API ("http://eap2mes:8088/App/ExecuteProcedure?"," EventType=APP_REELIDSPLIT&InputJson= "+" {CODE:\ "+ newCodeText +"\ "}"); System.Diagnostics.Debug.WriteLine (CodeMsg); public static string HttpPost (string url, string body) {Encoding encoding = Encoding.UTF8 HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url); request.Method = "POST"; request.Accept = "text/html, application/xhtml+xml, * / *"; request.ContentType = "application/x-www-form-urlencoded"; byte [] buffer = encoding.GetBytes (body); request.ContentLength = buffer.Length Request.GetRequestStream () .Write (buffer, 0, buffer.Length); HttpWebResponse response = (HttpWebResponse) request.GetResponse (); using (StreamReader reader = new StreamReader (response.GetResponseStream (), Encoding.UTF8)) {return reader.ReadToEnd () } Mode 2Result / execute stored procedure / returns the Json string {"Result": "OK", "Msg": "", "Return_Data": ""} OR {"Result": "NG", "Msg": "Error Msg" JObj.Add ("FunctionID", "REELID-SPLIT"); JObj.Add ("CODE", "20210605141700254036004.078.0050010"); string CodeMsg = Utility.ExecuteProcedure (JObj.ToString ()); System.Diagnostics.Debug.WriteLine (CodeMsg)
Quote api dll
The above is all the contents of the article "what are the methods called by API in C#". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.