Skip to main content

Member is obsolete

In This Article

CodeRush Classic displays the Member is obsolete code issue in a XAML document if the current member has the Obsolete attribute.

#Fix

Use another member instead of the obsolete member.

#Purpose

Highlights the reference to an obsolete member, which would cause the ‘Member is obsolete’ warning.

#Example

[Obsolete("Use 'MyNewClass' instead.")]
public class MyClass
{
  . . .
}

Fix:

<Window x:Class="MyApplication.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:MyApplication"
        Title="MainWindow" Height="500" Width="400">
    <Grid>
        <Grid.Resources>
            <local:MyNewClass x:Key="MyClass"/>
        </Grid.Resources>
        <local:MyControl 
            MyClassProperty = "{StaticResource MyClass}"
        />
    </Grid>
</Window>