小编Jat*_*rma的帖子

访问基类通过c#中驱动的B类对象的函数

访问基类通过c#中的派生类B对象的函数是否有任何方法可以访问A类By B类对象的函数(Sum)并获得输出10.

Class A
{
    public int Sum(int i)
    {
        return i+3;
    }
}

Class B:A
{
     public int Sum(int i)
     {
          return i+4;
     }
}

B objectB=new B();

int result=objectB.Sum(7);

output:11
Run Code Online (Sandbox Code Playgroud)

c# oop

6
推荐指数
1
解决办法
92
查看次数

c#100.11到100.15和100.16到100.20

c#100.11到100.15和100.16到100.20

我尝试了所有这些东西,但这些都没有帮助我.

Math.Round(100.11, 2,MidpointRounding.AwayFromZero); //gives 100.11

Math.Round(100.11, 2,MidpointRounding.ToEven);//gives 100.11

Math.Round((Decimal)100.11, 2)//gives 100.11

(100.11).ToString("N2"); //gives "100.11"

Math.Floor(100.11);// gives 100.0

(100.11).ToString("#.##");//gives "100.11"

Math.Truncate(100.11);// gives  100.0

Math.Ceiling(100.11);//gives 101.0

(100.11).ToString("F4");// gives "100.1100"
Run Code Online (Sandbox Code Playgroud)

c#

6
推荐指数
2
解决办法
254
查看次数

如何更新集合类型对象中的值

我创建了一个类的列表对象,然后更新它的值,它的值不更新请帮助我这里是我的代码

public class LocationData
{
    public int LocId { get; set; }
    public string LocatinName { get; set; }
    public int ControlCount { get; set; }
    public Nullable<short> KeyType { get; set; }
    public Nullable<short> Financial_Reporting { get; set; }
    public Nullable<short> FraudRisk { get; set; }
    public Nullable<short> FinancialControl { get; set; }
    public Nullable<short> ELC { get; set; }
}

 var locList = location.Select(a =>
               new LocationData { LocatinName = a.Location, LocId = a.LocID });
Run Code Online (Sandbox Code Playgroud)

之后,我正在尝试更新此值:

locList.Where(a => …
Run Code Online (Sandbox Code Playgroud)

c#

1
推荐指数
1
解决办法
302
查看次数

标签 统计

c# ×3

oop ×1