我想使用AutoMapper来连接我的两个对象。它工作得很好,但现在我想将我的十进制项格式化为2位小数。
这就是我拥有的。我做错了什么?
Mapper.CreateMap<Object1, Object2>()
.ForMember(x => typeof(decimal), x => x.AddFormatter<RoundDecimalTwo>());
下面是RoundDecimalTwo格式化程序
public class RoundDecimalTwo : IValueFormatter
{
public string For
我需要添加两个没有符号的数字'a‘和'b’。
我找到了以下代码,使用了位操作
unsigned int add (unsigned int a,unsigned int b)
{
unsigned int carry, sum;
if (b == 0)
{
return a;
}
sum = a ^ b; // xor takes sum
carry = a & b; // collect carry;
carry = carry << 1;
return ( add (sum