我试图总结泛型集合中的值,我使用相同的确切代码在我的代码的其他部分执行此函数但似乎有ulong
数据类型的问题?
代码
Items.Sum(e => e.Value);
Run Code Online (Sandbox Code Playgroud)
有以下错误:
错误15以下方法或属性之间的调用不明确:'
System.Linq.Enumerable.Sum<System.Collections.Generic.KeyValuePair<int,ulong>>(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<int,ulong>>, System.Func<System.Collections.Generic.KeyValuePair<int,ulong>,float>)
'和'System.Linq.Enumerable.Sum<System.Collections.Generic.KeyValuePair<int,ulong>>(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<int,ulong>>, System.Func<System.Collections.Generic.KeyValuePair<int,ulong>,decimal?>
)
public class Teststuff : BaseContainer<int, ulong, ulong>
{
public decimal CurrentTotal { get { return Items.Sum(e => e.Value); } }
public override void Add(ulong item, int amount = 1)
{
}
public override void Remove(ulong item, int amount = 1)
{
}
}
public abstract class BaseContainer<T, K, P>
{
/// <summary>
/// Pass in the owner of this container.
/// </summary>
public …
Run Code Online (Sandbox Code Playgroud) 通过MULTI的命令行命令读取,我无法通过命令行找到合适的命令来构建项目(gpj).
我尝试过多构建并收到以下错误:构建(从命令行启动)无法生成"''-noconsole -prefixed_progress".构建失败
提前感谢有关如何从命令行或mbs脚本调用构建的任何建议.
我有一个方法,删除字符串上的描述字,但我相信有更有效的方法来做到这一点.
该iMonster
可以像脂肪兽人盗贼,和我想删除的脂肪.
private static string[] _adjectives = { "angry",
"big",
"fat",
"happy",
"large",
"nasty",
"fierce",
"thin",
"small",
"tall",
"short" };
private static string RemoveMonsterAdjective(string iMonster)
{
foreach (string adjective in _adjectives)
{
if (iMonster.Contains(adjective))
{
iMonster = iMonster.Replace(adjective, "").Trim();
break;
}
}
return iMonster;
}
Run Code Online (Sandbox Code Playgroud)
希望有人可以帮助我.提前致谢.
我想将一些扩展的ascii字符存储到字典中进行查找,但是获得转换几乎没有问题.
我必须存储这些字符的当前方法适用于所有非图形化的ascii字符0x20到0xAF.
目前的方法:
private static void LoadAnsiTable()
{
for (byte i = 0x20; i < 0xFE; i++)
{
AnsiLookup.Add(i, Convert.ToChar(i).ToString());
}
}
Run Code Online (Sandbox Code Playgroud)
但是0xAF和on没有░▒▓┤╡╢等等它只有这些时髦的字母.
查看此表http://www.asciitable.com/以供参考.
如果我手动添加它,这是有效的,
AnsiLookup.Add(0xB0, "?");
Run Code Online (Sandbox Code Playgroud)
我想知道如何在某种类型的集合中捕获这些符号,而无需手动添加它们?