What are the methods called by API in C #
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!