logo
  • 教程列表
  • SO官方文檔
  • 結構
    • 宣告一個結構
    • 結構用法
    • 結構實現介面
    • 根據作業複製結構
  1. StackOverflow 文件
  2. C# Language 教程
  3. 結構
  4. 結構實現介面

結構實現介面

Created: November-22, 2018

public interface IShape
{
    decimal Area();
}

public struct Rectangle : IShape
{
    public decimal Length { get; set; }
    public decimal Width { get; set; }

    public decimal Area()
    {
        return Length * Width;
    }
}
  • 根據作業複製結構
  • 結構用法

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明