我有一张这样的桌子
ID | Type | Val0 | Val1
1 | 0 | A | NULL
2 | 1 | NULL | B
Run Code Online (Sandbox Code Playgroud)
我需要选择Val0何时类型为0,Val1何时类型为1,ValN何时类型为N ...
我怎样才能做到这一点?
我正在尝试以下方法
string tl = " aaa, bbb, ccc, dddd eeeee";
var tags = new List<string>();
tags.AddRange(tl.Split(','));
tags.ForEach(x => x = x.Trim().TrimStart().TrimEnd());
var result = String.Join(",", tags.ToArray());
Run Code Online (Sandbox Code Playgroud)
但它不起作用,标签总是以"aaa","bbb"的形式返回.
如何修剪列表中的所有元素?
我有以下字符串
áéíóú
Run Code Online (Sandbox Code Playgroud)
我需要将其转换为
aeiou
Run Code Online (Sandbox Code Playgroud)
我怎样才能实现它?(我不需要比较,我需要新的字符串来保存)
不重复如何从.NET中的字符串中删除变音符号(重音符号)?.那里接受的答案没有解释任何事情,这就是为什么我"重新开启"它.
我有两个项目:
我的类库项目包含一个app.config文件.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="TestEntities" connectionString="metadata=res://*/DBNews.csdl|res://*/DBNews.ssdl|res://*/DBNews.msl;provider=System.Data.SqlClient;provider connection string="{0}"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
从Console项目我想从类库中访问设置,所以我尝试过:
var config = ConfigurationManager.OpenExeConfiguration("Test.Data.dll");
config.ConnectionStrings.ConnectionStrings[0].Name; // LocalSqlServer
// seems to be the wrong assembly.
Run Code Online (Sandbox Code Playgroud)
和:
var config = ConfigurationManager.OpenExeConfiguration("Test.Data.dll.config");
// invalid exePath
Run Code Online (Sandbox Code Playgroud)
我该如何访问DLL app.config?
我做了一个web.config(完整文件,它没有显示XML错误)
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
...
<location path="." inheritInChildApplications="false">
<connectionStrings>
<add name="ElmahLog" connectionString="data source=~/App_Data/Error.db" />
<add name="database" connectionString="w" providerName="System.Data.EntityClient"/>
</connectionStrings>
</location>
...
Run Code Online (Sandbox Code Playgroud)
使用转换文件(web.Staging.config)
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="database"
connectionString="c"
providerName="System.Data.EntityClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<customErrors defaultRedirect="error.aspx"
mode="RemoteOnly" xdt:Transform="Replace">
</customErrors>
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我在Staging模式下发布(右键单击网站>发布>方法:文件系统...)
------ Build started: Project: Drawing, Configuration: Staging Any CPU ------
Drawing -> D:\Project\bin\Staging\Drawing.dll
------ Build started: Project: MySystem, Configuration: Staging Any CPU ------ …Run Code Online (Sandbox Code Playgroud) 我有两个清单
List 01 => { A, B, C, D, E }
List 02 => { F, F, F, F, E }
Run Code Online (Sandbox Code Playgroud)
我需要检查是否List 02存在一个元素List 01,所以以下内容应该是false.
List 01 => { A, B, C, D, E }
List 02 => { F, F, F, F, F } // no element matches
Run Code Online (Sandbox Code Playgroud)
这应该是true.
List 01 => { A, B, C, D, E }
List 02 => { F, F, F, F, B } // last element …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取一个列,但将其限制为使用范围...
public static Excel.Application App = new Excel.Application();
public static Excel.Workbook WB;
WB = App.Workbooks.Open("xxx.xls", ReadOnly: true);
var sheet = (WB.Sheets[1] as Excel.Worksheet);
// returns 65536 rows, I want only 82 (used range)
sheet.get_Range("F:F");
sheet.UsedRange.get_Range("F:F").Rows.Count; // 65536
Run Code Online (Sandbox Code Playgroud)
我怎么才能得到它?
我们使用jQuery来解析一些HTML.然后我需要遍历该文档并找到一些元素.在我需要找到的<link>元素中,有元素.
这非常适合提取所有<a>元素:
$(string).find("a")
Run Code Online (Sandbox Code Playgroud)
但这不能提取<link>元素:
$(string).find("link")
Run Code Online (Sandbox Code Playgroud)
该string参数是HTML内容(例如,在请求中接收).
知道为什么吗?(我想find这只适用于<body>元素).另外,关于如何实际提取这些<link>元素的任何想法?
我有这个代码,只在一次运行一次下载时工作
using (System.IO.FileStream fs = System.IO.File.OpenRead(@"C:\HugeFile.GBD"))
{
using (System.IO.BinaryReader br = new System.IO.BinaryReader(fs))
{
Response.AddHeader("Cache-control", "private");
Response.AddHeader("Content-Type", "application/octet-stream");
Response.AddHeader("Content-Length", fs.Length.ToString());
Response.AddHeader("Content-Disposition", "filename=HugeFile.GBD");
Response.Flush();
float kbs = 20f;
while (fs.Position < fs.Length)
{
if (!Response.IsClientConnected)
break;
byte[] bytes = br.ReadBytes((int)Math.Truncate(1024 * kbs));
char[] c = UTF8Encoding.Default.GetChars(bytes);
Response.Write(c, 0, c.Length);
Response.Flush();
System.Threading.Thread.Sleep(1000);
}
Response.Flush();
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我同时建立两个连接(在同一个浏览器上开始第二次下载),那么第二个连接将在第一次完成后才会执行.
将标题添加到Response... 时,使用线程或任务会导致错误
我怎样才能做到这一点我可以在同一个浏览器上同时执行2+下载?
我正在创建一个ListView,它在ViewCell中有一些简单的项目.
当我选择其中一个项目时,它变为橙色.当我单击并按住(打开上下文操作)时,它变为白色......

<ListView ItemsSource="{Binding Items}" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.ContextActions>
<MenuItem Text="Delete" />
</ViewCell.ContextActions>
<StackLayout Orientation="Horizontal" Padding="20">
<StackLayout HorizontalOptions="StartAndExpand">
<Label Text="{Binding Name}" FontSize="Large" FontAttributes="Bold" />
<Label Text="{Binding Description}" />
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Run Code Online (Sandbox Code Playgroud)
我该如何自定义这些颜色?
c# ×7
.net ×3
linq ×2
.net-4.0 ×1
android ×1
app-config ×1
asp.net ×1
asp.net-mvc ×1
deployment ×1
dom ×1
download ×1
excel ×1
interop ×1
jquery ×1
sql ×1
sql-server ×1
t-sql ×1
web-config ×1
xamarin ×1