AutoResetEvent 方法名称设计缺陷

这个类和方法,让人乍一读是读不明白的。不能通过方法名称明白其含义。所以它的方法名称设计是欠考虑。

 

应该类似于这样:

    public static class MyAutoResetEvent
    {
        public static AutoResetEvent StartBusy()
        {
            return new AutoResetEvent(false);
        }

        public static AutoResetEvent StartCompleted()
        {
            return new AutoResetEvent(true);
        }

        public static bool SetCompleted(this AutoResetEvent EventObject)
        {
            return EventObject.Set();
        }

        public bool ResetBusy(this AutoResetEvent EventObject)
        {
            return EventObject.Reset();
        }
    }

 

 

 

 

 

posted @ 2014-02-18 09:40  NewSea  阅读(245)  评论(0编辑  收藏  举报