我正在尝试将下面的XML反序列化为类,将Components反序列化为a List<string>,但无法弄清楚如何执行此操作.解串器适用于所有其他属性,但不适用Components.有人知道怎么做吗?
<ArsAction>
<CustomerName>Joe Smith</CustomerName>
<LoginID>jdsmith</LoginID>
<TicketGroup>DMS</TicketGroup>
<Software>Visio 2007 Pro</Software>
<Components>
<Component>Component 1</Component>
<Component>Component 2</Component>
</Components>
<Bldg>887</Bldg>
<Room>1320p</Room>
</ArsAction>
Run Code Online (Sandbox Code Playgroud) 我有一个简单的报告,当我尝试在VS中预览报告时,不断抛出"索引超出范围"错误.当我将报告部署到SSRS时,它完美地运行.我已经彻底找到了答案,但似乎没有一个适用于我的情况.
错误:索引超出范围.必须是非负数且小于集合的大小.参数名称:index.
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<Body>
<ReportItems>
<Textbox Name="textbox1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Sales Report</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>20pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>SteelBlue</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox1</rd:DefaultName>
<Height>0.36in</Height>
<Width>7.5in</Width>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="Tablix1">
<TablixCorner>
<TablixCornerRows>
<TablixCornerRow>
<TablixCornerCell>
<CellContents>
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Sales Person</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents> …Run Code Online (Sandbox Code Playgroud) long m = 24 * 60 * 60 * 1000 * 1000;
Run Code Online (Sandbox Code Playgroud)
上面的代码创建溢出并且不会打印正确的结果.
long m2 = 24L * 60 * 60 * 1000 * 1000;
long m3 = 24 * 60 * 60 * 1000 * 1000L;
Run Code Online (Sandbox Code Playgroud)
以上2行打印正确的结果.
我的问题是 -
m2还是m3?我有以下代码行:
var selectedDomainID = lkuDomainType.EditValue.Equals(null)
? string.Empty
: lkuDomainType.EditValue;
Run Code Online (Sandbox Code Playgroud)
有时会产生一个NullReferenceException.我不明白的是为什么.是不是要检查我的代码的全部要点,null如果是这样的话string.empty?当我检查DEBUG时,它说明EditValue == null了我错过了什么?
我试图读取一个JSON文件并解析它.我有这个代码从我的文件中读取
StreamReader re = new StreamReader("artists.json");
JsonTextReader reader = new JsonTextReader(re);
Run Code Online (Sandbox Code Playgroud)
但是我现在如何从读者解析它以便我可以从文件中搜索数据?
我试过阅读文档但找不到任何东西
FilePrefixList.Any(s => FileName.StartsWith(s))
Run Code Online (Sandbox Code Playgroud)
我可以s在这里获得价值吗?我想显示匹配的字符串.
我在我的解决方案中使用csproj中的Windows应用程序,并且我想使用命令行生成发布(bat,cmd).
我的剧本是(我\r\n为了更好的阅读):
SET MSBUILD="%SystemRoot%\Microsoft.NET\Framework\v3.5\MSBuild.exe"
SET CARWIN="..\..\Security.CarWin.csproj"
rem msbuild para publish
%MSBUILD% /target:rebuild;publish %CARWIN%
/p:ApplicationVersion="1.0.0.0"
/p:Configuration=release
/p:PublishUrl="C:\ClickOnce\CarWin.WebInstall\Publicacion\"
/p:InstallUrl="http://desserver/carwinclickonce/Publicacion/"
/p:PublishDir="C:\ClickOnce\CarWin.WebInstall\Publicacion\"
Run Code Online (Sandbox Code Playgroud)
注意:我也会尝试使用 /target:publish
但在路径PublishDir或PublishUrl(C:\ ClickOnce\CarWin.WebInstall\Publicacion)中不生成任何文件.
我在这个网站和谷歌看过很多帖子,但我找不到任何解决方案.
当我进入他们的文件时,我突然在.Net框架源代码中调试,Visual Studio 2010引发了这个错误:
文件加载:
加载文件XXX时,某些字节已被Unicode替换字符替换,保存文件将不保留原始文件内容.
当我单击"确定"时,文件被标记为未保存,当您尝试保存文件时,它表示该文件已被锁定,但我可以覆盖该文件.我不知道这个消息意味着什么.
为什么现在,这不是Visual Studio第一次从Symbol服务器下载文件?
我需要获取目录中的所有文件名,并将它们存储在命令行的某个变量中.
我遇到过这个
`dir /s /b > print.txt`
Run Code Online (Sandbox Code Playgroud)
但是这会将文件名打印到txt文件.
如何将这些名称存储在变量中?