class File
def File.Open(*args)
result=f=File.new(*args)
if block_given?
begin
result=yield f
ensure
f.close
end
return result
注: ensure用于必定要执行的语句