- Java锁的逻辑(结合对象头和ObjectMonitor)
- 还在用饼状图?来瞧瞧这些炫酷的百分比可视化新图形(附代码实现)⛵
- 自动注册实体类到EntityFrameworkCore上下文,并适配ABP及ABPVNext
- 基于Sklearn机器学习代码实战
以下代码的功能是用户可以实现业务中用户虚拟钱包的钱提现到用户银行卡,其实本质上是把商户的账户资金划转到用户银行卡,其实就是银行转账,相关代码如下:
///此方法存在部分业务代码,核心方法是doProcess方法且基本是可以复用的,其它的代码可以根据自身业务场景灵活处理;
public async Task<WithDrawResultDto> WithDrawToBank(TransferToBankDto transferToBankDto) { decimal balance = await _repository.WalletRepository.GetWalletBalance( new Contract.User.UserBasicDto() { WeChatId = transferToBankDto.WeChatId, }); if (balance < transferToBankDto.Amount) { return new WithDrawResultDto() { WithDrawResult = false , Message = " 可用余额不够,请重新输入提现金额。 " }; } long userId = await _repository.UserRepository.GetUserIdByWeChatId(transferToBankDto.WeChatId); if (userId == 0 ) { return new WithDrawResultDto() { WithDrawResult = false , Message = " 用户不存在 " }; } // bool walletToBankResult = await _walletService.WalletToBankAccount(transferToBankDto.WeChatId, userId, transferToBankDto.Amount, (int)WalletCashType.Withdrawing, yurRef); // if (walletToBankResult) // { Log.Information( " begin WithDraw call cloud direct " ); string reqId = DCHelper.GetTime() + RandomHelper.GeneratorRandomStr( 7 ); decimal amount = transferToBankDto.Amount; string bankCode = await _repository.BankRepository.QueryBankCodeByBankAccount(userId, transferToBankDto.BankAccount); string bankHolder = await _repository.BankRepository.QueryCardHolder(userId, transferToBankDto.BankAccount); Log.Information($ " bankHolder:{bankHolder} " ); // 记录业务编号 // 业务编号记录到数据库 // 组织发送报文 JObject obj = new JObject(); JObject req = new JObject(); JArray bb1paybmx1BodyArray = new JArray(); JObject bb1paybmx1Body = new JObject(); JObject bb1paybmx1Body2 = new JObject(); JArray bb1payopx1BodyArray = new JArray(); JObject bb1payopx1Body = new JObject(); JObject bb1payopx1Body2 = new JObject(); JObject head = new JObject(); head.Add( " funcode " , FunCode);// FunCode = "BB1PAYOP";功能代码 head.Add( " userid " , UID);//用户编号,与商户相关 head.Add( " reqid " , reqId); bb1paybmx1Body.Add( " busCod " , BusCod);//BusCod = "N02030";业务编码 bb1paybmx1Body.Add( " busMod " , BusMod);///业务模式 bb1paybmx1BodyArray.Add(bb1paybmx1Body); // bb1paybmx1Body2.Add("bb1paybmx1", bb1paybmx1BodyArray); JArray bb1payopx1 = new JArray(); bb1payopx1Body.Add( " dbtAcc " , CompanyCard);//公司账号 bb1payopx1Body.Add( " crtAcc " , transferToBankDto.BankAccount);//收款人账号 bb1payopx1Body.Add( " crtNam " , bankHolder);//持卡人姓名 bb1payopx1Body.Add( " ccyNbr " , CurrencyCode);//币种 CurrencyCode = "10";//10代表人民币 bb1payopx1Body.Add( " trsAmt " , amount.ToString( " #0.00 " )); // bb1payopx1Body.Add("crtBnk", "招商银行深圳分行"); bb1payopx1Body.Add( " bnkFlg " , (bankCode == CMBCode ? " Y " : " N " ));//CMBCodeCMBCode = "CMB";如果是招商银行,bnkFlg的取值是Y bb1payopx1Body.Add( " stlChn " , StlChn);//StlChn为R代表及时到账 bb1payopx1Body.Add( " nusAge " , " 钱包提现到银行卡 " ); // bb1payopx1Body.Add("yurRef", "202008260078000033"); bb1payopx1Body.Add( " yurRef " , yurRef);//业务流水号,可以使用雪花算法生成 bb1payopx1BodyArray.Add(bb1payopx1Body); JObject jobjectBodyList = new JObject(); jobjectBodyList.Add( " bb1paybmx1 " , bb1paybmx1BodyArray); jobjectBodyList.Add( " bb1payopx1 " , bb1payopx1BodyArray); JObject jobjectBody = new JObject(); jobjectBody.Add( " body " , jobjectBodyList); jobjectBody.Add( " head " , head); JObject requestBody = new JObject(); requestBody.Add( " request " , jobjectBody); // bb1payopx1Body2.Add("bb1payopx1", bb1payopx1BodyArray); // 请求发送接收 var withDrawResult = doProcess(requestBody, FunCode); if (withDrawResult.WithDrawResult == true ) { bool walletToBankResult = await _walletService.WalletToBankAccount(transferToBankDto.WeChatId, userId, transferToBankDto.Amount, ( int )WalletCashType.Withdrawing, yurRef); WithDrawToBankRecord withDrawToBankRecord = new WithDrawToBankRecord (userId: userId, funcode: FunCode, reqid: reqId, busCod: BusCod, busMod: BusMod, dbtAcc: CompanyCard, crtAcc: transferToBankDto.BankAccount, crtNam: bankHolder, ccyNbr: CurrencyCode, trsAmt: amount, bnkFlg: (bankCode == CMBCode ? " Y " : " N " ), stlChn: StlChn, nusAge: " 钱包提现到银行卡 " , yurRef: yurRef.ToString(), withdrawStatus: 0 ,openId: transferToBankDto.OpenId); await _repository.RedPackageRepository.CreateWithDrawToBankRecord(withDrawToBankRecord); await WithDrawSendMsgToClient.SendMsgToClient(openId: transferToBankDto.OpenId, templageId: SuccessTemplateId, amount: amount, withdrawDatetime: DateTime.Now.ToString( " yyyy-MM-dd HH:mm:ss " ), WithdrawToBankStatus.Success); } // 更新出金时间 await _repository.BankRepository.UpdateWithDrawDateTimeAsync(userId, transferToBankDto.BankAccount); return withDrawResult; // } // else // { // return new WithDrawResultDto() { WithDrawResult = false,Message="提现失败,请稍后重试." }; // } }
DCHelper辅助类 。
using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace Demo.Utils { public class DCHelper { public static string SerialJsonOrdered(JObject json) { List < string > keyList = new List< string > (); foreach ( var x in json) { keyList.Add(x.Key); } string [] keyArray = keyList.ToArray(); Array.Sort(keyArray, string .CompareOrdinal); StringBuilder appender = new StringBuilder(); appender.Append( " { " ); bool isFirstEle = true ; foreach ( var key in keyArray) { if (! isFirstEle) { appender.Append( " , " ); } Object val = json[key]; if (val is JObject) { appender.Append( " \" " ).Append(key).Append( " \": " ); appender.Append(SerialJsonOrdered((JObject)val)); } else if (val is JArray) { JArray jarray = (JArray)val; appender.Append( " \" " ).Append(key).Append( " \":[ " ); bool isFirstArrEle = true ; for ( int i = 0 ; i < jarray.Count; i++ ) { if (! isFirstArrEle) { appender.Append( " , " ); } Object obj = jarray[i]; if (obj is JObject) { appender.Append(SerialJsonOrdered((JObject)obj)); } else { appender.Append(obj.ToString()); } isFirstArrEle = false ; } appender.Append( " ] " ); } else if (((JToken)val).Type == JTokenType.String) { string value = val.ToString(); appender.Append( " \" " ).Append(key).Append( " \": " ).Append( " \" " ).Append(value.Replace( " \\ " , " \\\\ " )).Append( " \" " ); } else if (((JToken)val).Type == JTokenType.Boolean) { string value = val.ToString().ToLower(); appender.Append( " \" " ).Append(key).Append( " \": " ).Append(value); } else { string value = val.ToString(); appender.Append( " \" " ).Append(key).Append( " \": " ).Append(value); } isFirstEle = false ; } appender.Append( " } " ); return appender.ToString(); } public static String GetTime() { return DateTime.Now.ToString( " yyyyMMddHHmmssfff " ); } public static String GetTime2() { return DateTime.Now.ToString( " yyyyMMddHHmmss " ); } // 发送Post请求 public static String DoPostForm(String httpUrl, Hashtable param) { Encoding encoding = Encoding.GetEncoding( " utf-8 " ); HttpWebResponse response = PostHttps(httpUrl, param, encoding); Stream stream = response.GetResponseStream(); StreamReader sr = new StreamReader(stream); return sr.ReadToEnd(); } private static bool CheckValidationResult( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true ; // 信任所有https站点证书,不安全,请勿在生产环境中使用。 } private static HttpWebResponse PostHttps( string url, Hashtable param, Encoding encoding) { HttpWebRequest request = null ; // ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult); // 请勿在生产环境中使用该行程序 request = WebRequest.Create(url) as HttpWebRequest; request.ProtocolVersion = HttpVersion.Version11; request.Method = " POST " ; request.ContentType = " application/x-www-form-urlencoded " ; request.Timeout = 15000 ; request.KeepAlive = false ; request.ReadWriteTimeout = 60000 ; byte [] data = encoding.GetBytes(CreateLinkString(param)); request.ContentLength = data.Length; using (Stream stream = request.GetRequestStream()) { stream.Write(data, 0 , data.Length); } WebResponse res; try { res = request.GetResponse(); } catch (WebException e) { res = e.Response; } return (HttpWebResponse)res; } private static string CreateLinkString(Hashtable param) { IEnumerator keys = param.Keys.GetEnumerator(); StringBuilder prestr = new StringBuilder(); int i = 0 ; while (keys.MoveNext()) { i ++ ; string key = keys.Current as string ; string value = param[key] as string ; if (i == param.Count) { prestr.Append(key).Append( " = " ).Append(value); } else { prestr.Append(key).Append( " = " ).Append(value).Append( " & " ); } } return prestr.ToString(); } } }
RandomHelper辅助类 。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Demo.Utils { public static class RandomHelper { public static string GeneratorRandomStr( int len) { string chars = " 0123456789abcdefghijklmnopqrstuvwxyz " ; Random randrom = new Random(( int )DateTime.Now.Ticks); string str = "" ; for ( int i = 0 ; i < len; i++ ) { str += chars[randrom.Next(chars.Length)]; } return str; } } }
。
核心方法:
private WithDrawResultDto doProcess(JObject jObject, string FUNCODE) { JObject obj = new JObject(); // 签名 obj.Add( " sigdat " , " __signature_sigdat__ " ); obj.Add( " sigtim " , DCHelper.GetTime2()); jObject.Add( " signature " , obj); string source = DCHelper.SerialJsonOrdered(jObject); Console.WriteLine( " 签名原文: " + source); Log.Information($ " {FUNCODE} request data is {source} " ); Encoding encoding = Encoding.UTF8; byte [] signature1 = DCCryptor.CMBSM2SignWithSM3(GetID_IV(), Convert.FromBase64String(privkey), encoding.GetBytes(source));//privkey是私钥 string sigdat1 = Convert.ToBase64String(signature1); Console.WriteLine( " 签名结果: " + sigdat1); obj[ " sigdat " ] = sigdat1; // SM4-CBC加密 string plaintxt = jObject.ToString(); Console.WriteLine( " 加密前req: " + plaintxt); byte [] enInput = DCCryptor.CMBSM4EncryptWithCBC(encoding.GetBytes(sm4key), GetID_IV(), encoding.GetBytes(plaintxt));//sm4key是用户的对称密钥 string req = Convert.ToBase64String(enInput); Console.WriteLine( " 加密后req: " + req); Log.Information( " begin send request to cloud direct " ); // 发送请求 Hashtable map = new Hashtable(); map.Add( " UID " , UID); map.Add( " ALG " , ALG_SM);//ALG_SM = "SM";采用国密算法 map.Add( " DATA " , HttpUtility.UrlEncode(req, encoding)); map.Add( " FUNCODE " , FUNCODE); string res = DCHelper.DoPostForm(URL, map);//访问招商银行的api请求地址:(测试环境:http://cdctest.cmburl.cn/cdcserver/api/v2;正式环境:https://cdc.cmbchina.com/cdcserver/api/v2) Log.Information( " end request " ); Console.WriteLine( " res: " + res); Log.Information( " DoPostForm {@res} " , res); try { Convert.FromBase64String(res); } catch (Exception ex) { Console.WriteLine( " 访问返回错误. " ); Log.Information( " Convert.FromBase64String error {@ex} " , ex); return new () { WithDrawResult = false , Message = " 访问返回错误. " }; } // 解密请求 string resplain = encoding.GetString(DCCryptor.CMBSM4DecryptWithCBC(encoding.GetBytes(sm4key), GetID_IV(), Convert.FromBase64String(res))); Console.WriteLine( " res decrypt: " + resplain); Log.Information($ " {FUNCODE} response data is {resplain} " ); // 验签 JObject object2 = JObject.Parse(resplain); JObject ? object3 = object2[ " signature " ] as JObject; string ? resSign = object3?[ " sigdat " ]? .ToString(); object3[ " sigdat " ] = " __signature_sigdat__ " ; object2[ " signature " ] = object3; string resSignSource = DCHelper.SerialJsonOrdered(object2); Console.WriteLine( " 验签原文: " + resSignSource); Console.WriteLine( " 验签签名值: " + resSign); bool verify = DCCryptor.CMBSM2VerifyWithSM3(GetID_IV(), Convert.FromBase64String(bankpubkey), encoding.GetBytes(resSignSource), Convert.FromBase64String(resSign));//bankpubkey:银行公钥 Console.WriteLine( " 验签结果: " + verify); Log.Information($ " 验签结果:{verify} " ); if (verify) { // 验签成功以后正常判断 if (object2[ " response " ]?[ " head " ]?[ " resultcode " ] is not null ) { string ? resultCode = object2[ " response " ]?[ " head " ]?[ " resultcode " ]? .ToString(); if (resultCode != " SUC0000 " ) { Log.Information($ " withdraw hava error,resultmsg is {object2[ " response " ]?[ " head " ]?[ " resultmsg " ]?.ToString()}, " + $ " resultcode is {object2[ " response " ]?[ " head " ]?[ " resultcode " ]?.ToString()} " ); return new () { WithDrawResult = false , Message = object2[ " response " ]?[ " head " ]?[ " resultmsg " ]? .ToString() }; } else { string [] errors = new [] { " F " , " B " , " R " , " D " , " C " }; string ? rtnFlg = object2[ " response " ]?[ " body " ]?[ " bb1payopz1 " ][ 0 ]?[ " rtnFlg " ]? .ToString(); if (object2[ " response " ]?[ " body " ]?[ " bb1payopz1 " ][ 0 ]?[ " reqSts " ]?.ToString() == " FIN " && errors.Contains(rtnFlg)) { Log.Information($ " withdraw hava error,errTxt is {object2[ " response " ]?[ " body " ]?[ " bb1payopz1 " ][0]?[ " errTxt " ]?.ToString()}, " + $ " errCod is {object2[ " response " ]?[ " body " ]?[ " bb1payopz1 " ][0]?[ " errCod " ]?.ToString()} " ); return new () { WithDrawResult = false , Message = object2[ " response " ]?[ " body " ]?[ " bb1payopz1 " ][ 0 ]?[ " errTxt " ]? .ToString() }; } } } } else { Log.Error( " 验签失败 " ); return new () { WithDrawResult = false , Message = " 验签失败,请联系系统管理员。 " }; } return new () { WithDrawResult = true }; }
私有方法 。
private byte [] GetID_IV() { String uid = UID; // 请替换为实际的用户UID String userid = uid + " 0000000000000000 " ; return Encoding.UTF8.GetBytes(userid.Substring( 0 , 16 )); }
。
DCCryptor辅助类 。
using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X9; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Signers; using Org.BouncyCastle.Math; using Org.BouncyCastle.Math.EC; using Org.BouncyCastle.Security; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Demo.Utils { public class DCCryptor { public static byte [] CMBSM4EncryptWithCBC( byte [] key, byte [] iv, byte [] input) { if (key == null || iv == null || input == null ) { throw new Exception( " CMBSM4EncryptWithCBC 非法输入 " ); } return CMBSM4Crypt(key, iv, input, true ); } public static byte [] CMBSM4DecryptWithCBC( byte [] key, byte [] iv, byte [] input) { if (key == null || iv == null || input == null ) { throw new Exception( " CMBSM4DecryptWithCBC 非法输入 " ); } return CMBSM4Crypt(key, iv, input, false ); } public static byte [] CMBSM2SignWithSM3( byte [] id, byte [] privkey, byte [] msg) { if (privkey == null || msg == null ) { throw new Exception( " CMBSM2SignWithSM3 input error " ); } ECPrivateKeyParameters privateKey = EncodePrivateKey(privkey); SM2Signer signer = new SM2Signer(); ParametersWithID parameters = new ParametersWithID(privateKey, id); signer.Init( true , parameters); signer.BlockUpdate(msg, 0 , msg.Length); return DecodeDERSignature(signer.GenerateSignature()); } public static bool CMBSM2VerifyWithSM3( byte [] id, byte [] pubkey, byte [] msg, byte [] signature) { if (pubkey == null || msg == null || signature == null ) { throw new Exception( " CMBSM2VerifyWithSM3 input error " ); } ECPublicKeyParameters publicKey = EncodePublicKey(pubkey); SM2Signer signer = new SM2Signer(); ParametersWithID parameters = new ParametersWithID(publicKey, id); signer.Init( false , parameters); signer.BlockUpdate(msg, 0 , msg.Length); return signer.VerifySignature(EncodeDERSignature(signature)); } private static byte [] CMBSM4Crypt( byte [] keyBytes, byte [] iv, byte [] input, bool forEncrypt) { KeyParameter key = ParameterUtilities.CreateKeyParameter( " SM4 " , keyBytes); ParametersWithIV ivParameterSpec = new ParametersWithIV(key, iv); IBufferedCipher cipher = CipherUtilities.GetCipher( " SM4/CBC/PKCS7Padding " ); cipher.Init(forEncrypt, ivParameterSpec); return cipher.DoFinal(input); } private static ECPrivateKeyParameters EncodePrivateKey( byte [] value) { BigInteger d = new BigInteger( 1 , value); X9ECParameters spec = ECNamedCurveTable.GetByName( " sm2p256v1 " ); ECDomainParameters ecParameters = new ECDomainParameters(spec.Curve, spec.G, spec.N, spec.H, spec.GetSeed()); return new ECPrivateKeyParameters(d, ecParameters); } public static ECPublicKeyParameters EncodePublicKey( byte [] value) { byte [] x = new byte [ 32 ]; byte [] y = new byte [ 32 ]; Array.Copy(value, 1 , x, 0 , 32 ); Array.Copy(value, 33 , y, 0 , 32 ); BigInteger X = new BigInteger( 1 , x); BigInteger Y = new BigInteger( 1 , y); X9ECParameters spec = ECNamedCurveTable.GetByName( " sm2p256v1 " ); ECPoint Q = spec.Curve.CreatePoint(X, Y); ECDomainParameters ecParameters = new ECDomainParameters(spec.Curve, spec.G, spec.N, spec.H, spec.GetSeed()); return new ECPublicKeyParameters(Q, ecParameters); } private static byte [] DecodeDERSignature( byte [] signature) { Asn1InputStream stream = new Asn1InputStream(signature); Asn1Sequence primitive = (Asn1Sequence)stream.ReadObject(); System.Collections.IEnumerator enumeration = primitive.GetEnumerator(); enumeration.MoveNext(); BigInteger R = ((DerInteger)enumeration.Current).Value; enumeration.MoveNext(); BigInteger S = ((DerInteger)enumeration.Current).Value; byte [] bytes = new byte [ 64 ]; byte [] r = Format(R.ToByteArray()); byte [] s = Format(S.ToByteArray()); Array.Copy(r, 0 , bytes, 0 , 32 ); Array.Copy(s, 0 , bytes, 32 , 32 ); return bytes; } private static byte [] EncodeDERSignature( byte [] signature) { byte [] r = new byte [ 32 ]; byte [] s = new byte [ 32 ]; Array.Copy(signature, 0 , r, 0 , 32 ); Array.Copy(signature, 32 , s, 0 , 32 ); Asn1EncodableVector vector = new Asn1EncodableVector(); vector.Add( new DerInteger( new BigInteger( 1 , r))); vector.Add( new DerInteger( new BigInteger( 1 , s))); return ( new DerSequence(vector)).GetEncoded(); } private static byte [] Format( byte [] value) { if (value.Length == 32 ) { return value; } else { byte [] bytes = new byte [ 32 ]; if (value.Length > 32 ) { Array.Copy(value, value.Length - 32 , bytes, 0 , 32 ); } else { Array.Copy(value, 0 , bytes, 32 - value.Length, value.Length); } return bytes; } } } }
。
最后此篇关于使用招商银行云直连服务提现(.Net6)的文章就讲到这里了,如果你想了解更多关于使用招商银行云直连服务提现(.Net6)的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
创建使用.NET框架的asp.net页面时,访问该页面的客户端是否需要在其计算机上安装.NET框架? IE。用户访问www.fakesite.com/default.aspx,如果他们没有安装框架,他
我阅读了很多不同的博客和 StackOverflow 问题,试图找到我的问题的答案,但最后我找不到任何东西,所以我想自己问这个问题。 我正在构建一个应用程序,其中有一个长时间运行的工作线程,它执行一些
已锁定。这个问题及其答案是locked因为这个问题是题外话,但却具有历史意义。目前不接受新的答案或互动。 我一直想知道为什么微软为这样一个伟大的平台选择了一个如此奇怪的、对搜索引擎不友好的名称。他们就
.Net Framework .Net .NET Standard的区别 1、.NET Framework 在未来.NET Framework或许成为过去时,目前还是有很多地方在使用的。这一套
如果有选择的话,您会走哪条路? ASP.NET Webforms + ASP.NET AJAX 或 ASP.NET MVC + JavaScript Framework of your Choice
我有一个 Web 服务,它通过专用连接通过 https 使用第三方 Web 服务,我应用了 ServicePointManager.ServerCertificateValidationCallbac
为什么我应该选择ASP.NET Web Application (.NET Framework)而不是ASP.NET Core Web Application (.NET Framework)? 我在
我在网络上没有找到任何关于包含 .NET Standard、.NET Core 和 .NET Framework 项目的 .NET 解决方案的公认命名约定。 就我而言,我们在 .NET 框架项目中有以
.NET Compact 是 .NET 的完美子集吗? 假设我考虑了屏幕大小和其他限制并避免了 .NET Compact 不支持的类和方法,或者 .NET Compact 是一个不同且不兼容的 GUI
我已经阅读了所有我能找到的关于 connectionManagement 中的 maxconnection 设置的文章:即 http://support.microsoft.com/kb/821268
我现在正在使用asp.net mvc,想知道使用内置的Json或 Json.Net哪个是更好的选择,但我不确定一个人是否比另一个人有优势。 另外,如果我确实选择沿用Json.Net的路线,那么我应该选
在 Visual Studio 中,您至少可以创建三种不同类型的类库: 类库(.NET Framework) 类库(.NET 标准) 类库(.NET Core) 虽然第一个是我们多年来一直使用的,但我
.NET 和 ASP.NET 之间有什么区别?它们有什么关系? 最佳答案 ASP.Net 基于 .Net 框架构建,提供有关 Web 开发的附加功能。 你可以去看看wikipedia article
在安装更高版本(3.0)之前,我需要安装.net框架1.1和2.0吗?或者单独安装 3.0 框架就足够了,并为在早期框架版本上编写的软件提供支持?谢谢 ,丽然 最佳答案 不,您不必安装以前的框架。 我
我正在开发一个项目,人们可以“更新”类别,例如更改类别的名称。我收到以下消息 This is called after clicking update 按钮 with the SQL statemen
.NET 类 System.Net.CookieContainer 线程安全吗? --更新:交 key 答复-- 是否有任何方法可以确保异步请求期间修改的变量(即 HttpWebRequest.Coo
我正在使用 JScript.NET 在我编写的 C# WinForms 应用程序中编写脚本。它工作得很好,但我只是尝试在脚本中放置一些异常处理,但我无法弄清楚如何判断我的 C# 代码抛出了哪种类型的异
我需要你的帮助, 比如我有一个小数类型的变量,我想这样取整。 例如 3.0 = 3 3.1 = 4 3.2 = 4 3.3 = 4 3.4 = 4 3.5 = 4 3.6 = 4 3.7 = 4 3.
我使用过这样的代码:http://msdn.microsoft.com/en-us/library/dw70f090.aspx在 ASP.NET 中工作之前访问数据库(2-3 年前)。我没有意识到我正
自 ConfigurationManager .NET Standard 中不存在,检索正在执行的程序集的应用程序设置的最佳方法是什么,无论是 web.config或 appSettings.{env
我是一名优秀的程序员,十分优秀!