How to deal with a sealed class when I wanted to inherit and add properties

前端 未结 6 1417
心在旅途
心在旅途 2020-12-15 15:34

In a recent question on Stack Overflow, I asked how I might parse through a file name to extra meta info about a file.

After I worked through that problem, I decided

6条回答
  •  -上瘾入骨i
    2020-12-15 16:06

    You could just expose the properties on FileInfo you care about. Something like this:

    public long Length { get { return FileInfo.Length; } }
    

    This obviously becomes less practical if you want to delegate a lot of properties to FileInfo.

提交回复
热议问题