Impossible to use ref and out in Extension methods?
        Posted  
        
            by Hun1Ahpu
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Hun1Ahpu
        
        
        
        Published on 2010-04-11T20:31:11Z
        Indexed on 
            2010/04/11
            20:33 UTC
        
        
        Read the original article
        Hit count: 382
        
c#
|extension-methods
Why is it forbidden to call Extension method with ref modifier?
This one is possible:
public static void Change(ref TestClass testClass, TestClass testClass2)
    {
        testClass = testClass2;
    }
And this one not:
public static void ChangeWithExtensionMethod(this ref TestClass testClass, TestClass testClass2)
    {
        testClass = testClass2;
    }
But why?
© Stack Overflow or respective owner