此代码用于使用Xe.com的货币转换器 [英] This code is use for Currency Convertor using Xe.com
问题描述
public void currency(string srcCurrency,string dstCurrency)
{
string xeString = String.Format(http://www.xe.com/ucc/ convert.cgi?Amount = 1&From = {0}&To = {1},srcCurrency,dstCurrency);
System.Net.WebRequest wreq = System.Net.WebRequest.Create(new Uri(xeString) ));
System.Net.WebResponse wresp = wreq.GetResponse();
Stream respstr = wresp.GetResponseStream();
int read = respstr.Read(buf,0,BUFFER_SIZE);
string result = Encoding.ASCII.GetString(buf,0,read);
}
错误:错误16当前上下文中不存在名称'BUFFER_SIZE'
public void currency(string srcCurrency,string dstCurrency)
{
string xeString = String.Format("http://www.xe.com/ucc/convert.cgi?Amount=1&From={0}&To={1}", srcCurrency, dstCurrency);
System.Net.WebRequest wreq = System.Net.WebRequest.Create(new Uri(xeString));
System.Net.WebResponse wresp = wreq.GetResponse();
Stream respstr = wresp.GetResponseStream();
int read = respstr.Read(buf, 0, BUFFER_SIZE);
string result = Encoding.ASCII.GetString(buf, 0, read);
}
error:Error 16 The name 'BUFFER_SIZE' does not exist in the current context
推荐答案
您没有声明变量 BUFFER_SIZE 。可能你已经在课程顶部创建了变量&将更多代码移到某个地方。检查 Stream.Read方法 [ ^ ]
You didn't declare the variable BUFFER_SIZE. Possibly you had created the variable at top of the class & moved that with some more code to somewhere. Check Stream.Read Method[^]
这篇关于此代码用于使用Xe.com的货币转换器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!