class File

  def File.Open(*args)

    result=f=File.new(*args)

    if block_given?

    begin

      result=yield f

    ensure

      f.close

    end

    return result

  end

end

 

注: ensure用于必定要执行的语句

相关文章:

  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2021-12-05
  • 2022-02-04
猜你喜欢
  • 2021-09-27
  • 2021-11-15
  • 2021-11-18
  • 2021-12-14
  • 2021-12-31
  • 2021-10-18
  • 2021-05-07
相关资源
相似解决方案