缓存的ResourceManager实例请求 - 如何将代码转换为Nemerle

时间:2010-02-18 10:21:23

标签: nemerle

C#CODE:

[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
    internal static global::System.Resources.ResourceManager ResourceManager {
        get {
            if (object.ReferenceEquals(resourceMan, null)) {
                global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("splashscreen.Properties.Resources", typeof(Resources).Assembly);
                resourceMan = temp;
            }
            return resourceMan;
        }
    }


    internal static ResourceManager : System.Resources.ResourceManager {
        get {
            when (object.ReferenceEquals(resourceMan, null)) {
                mutable temp : System.Resources.ResourceManager = System.Resources.ResourceManager("splashscreen.Properties.Resources", typeof(Resources).Assembly);
                resourceMan = temp;
            }
            resourceMan
        }
    }

够了吗?

1 个答案:

答案 0 :(得分:1)

我会这样写:

using System.ComponentModel;
using System;

// ...

[ EditorBrowsableAttribute(EditorBrowsableState.Advanced) ] 
internal static ResourceManager : Resources.ResourceManager 
{ 
    get
    { 
        when (object.ReferenceEquals(resourceMan, null))
        {
            resourceMan = Resources.ResourceManager
                ( "splashscreen.Properties.Resources"
                , typeof(Resources).Assembly
                ); 
        }
        resourceMan; 
    } 
}