What possible value (or danger) might this usage, non-usage, or abusage of System.Runtime.CompilerServices be?

StackOverflow https://stackoverflow.com/questions/15529961

Вопрос

In the legacy spaghetti, I came across this spicy meatball:

//Keep around, might prove useful.
namespace System.Runtime.CompilerServices
{
    public sealed class IsVolatile
    {
        private IsVolatile()
        {
        }
    }
}

Is this possibly of any value? Or perhaps a better question, possibly of any harm (to retain)?

Это было полезно?

Решение

Hah - looks like you've got a situation similar to the "I want LINQ syntax, but I'm in 2.0 land", where you could "turn on" LINQ syntax via:

namespace System.Runtime.CompilerServices
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
    public class ExtensionAttribute : Attribute
    {
    }
}

Only here, you're enabling use of the volatile keyword.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top