我是新手,有木有大神知道C#中RreadString的用法?
看样子貌似是读入字符串的,能有代码的例子就最好了,即使你说不明白,看代码也能看明白。。。。。。。。谢谢了...
看样子 貌似是读入字符串的,能有代码的例子就最好了,即使你说不明白,看代码也能看明白。。。。。。。。谢谢了
展开
2个回答
2011-09-12
展开全部
using System;
using System.Xml;
using System.IO;
namespace _823882CSharp
{
/// <summary>
/滑空// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>信亏瞎
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
StringReader sReader = new StringReader("<root><n1>1</n1><n2>2</n2></root>");
XmlTextReader r = new XmlTextReader(sReader);
r.MoveToContent();
r.Read();
Console.WriteLine("Node type and name after First Read = " +
r.NodeType + "空裂 : " + r.Name);
Console.WriteLine("ReadString result when positioned on " +
r.Name + " = " + r.ReadString());
Console.WriteLine("Node type and name after ReadString = " +
r.NodeType + " : " + r.Name);
r.Read();
Console.WriteLine("Node type and name after Second Read = " +
r.NodeType + " : " + r.Name);
Console.ReadLine();
}
}
}
using System.Xml;
using System.IO;
namespace _823882CSharp
{
/// <summary>
/滑空// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>信亏瞎
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
StringReader sReader = new StringReader("<root><n1>1</n1><n2>2</n2></root>");
XmlTextReader r = new XmlTextReader(sReader);
r.MoveToContent();
r.Read();
Console.WriteLine("Node type and name after First Read = " +
r.NodeType + "空裂 : " + r.Name);
Console.WriteLine("ReadString result when positioned on " +
r.Name + " = " + r.ReadString());
Console.WriteLine("Node type and name after ReadString = " +
r.NodeType + " : " + r.Name);
r.Read();
Console.WriteLine("Node type and name after Second Read = " +
r.NodeType + " : " + r.Name);
Console.ReadLine();
}
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把 int a=Sum.num1(Console.ReadLine());
int b=Sum.num2(Console.ReadLine());
Console.WriteLine();
换成简虚
Console.WriteLine("输姿银入num1");
Sum.num1=int.Parse(Console.ReadLine());
Console.WriteLine("输入num2");
Sum.num2=int.Parse(Console.ReadLine());
Sum.write();
Console.Read();
最后一行可以让程序不一闪就自己关闭了拦册燃
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询