示例#1
0
    static void Main()
    {
        string text = "abc";
        foreach (var foo in text) { }

        // no boxing
        using (var a = new DisposableStruct()) { }
        using (DisposableStruct.Instance) { }

        // yeah, no boxing too
        using (var b = new BadDisposableStruct()) { }
        using (BadDisposableStruct.Instance) { }
    }
示例#2
0
    static void Main()
    {
        string text = "abc";

        foreach (var foo in text)
        {
        }

        // no boxing
        using (var a = new DisposableStruct()) { }
        using (DisposableStruct.Instance) { }

        // yeah, no boxing too
        using (var b = new BadDisposableStruct()) { }
        using (BadDisposableStruct.Instance) { }
    }