<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>readspace</Title>
<Shortcut>readspace</Shortcut>
<Description>读取空格分割的整数</Description>
<Author>zhangweixiao@live.com</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<References>
<Reference>
<Assembly>System.dll</Assembly>
<Url></Url>
</Reference>
</References>
<Imports>
<Import>
<Namespace>System</Namespace>
</Import>
<Import>
<Namespace>System.IO</Namespace>
</Import>
</Imports>
<Declarations>
<Literal>
<ID>num1</ID>
<ToolTip>第一个值</ToolTip>
<Default>num1</Default>
</Literal>
<Literal>
<ID>num2</ID>
<ToolTip>第二个值</ToolTip>
<Default>num2</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[
StreamReader sr = File.OpenText(@"../../data.txt");
string str = null;
while ((str = sr.ReadLine()) != null)
{
str = str.Trim();
while (str.Contains(" "))
str = str.Replace(" ", "");
string[] splitStr = str.Split(new char[] {"" ""});
int $num1$ = Convert.ToInt32(splitStr[0]);
int $num2$= Convert.ToInt32(splitStr[1]);
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
上面代码段,需要用system.io下的类,不能自动导入吗?
也尝试了自带的。
解决方案:20分
很遗憾,不能,msdn上说了:
The Namespace element is only supported for Visual Basic projects.