Warnings through Chapter 18
MODIFY
src/Chapter18/BackupOfListingA18.11.SpecifyingAReturnAttribute.Description.cs
src/Chapter18/BackupOfListingA18.11.SpecifyingAReturnAttribute.Description.cs
@@ -4,8 +4,8 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_11
{
public class DescriptionAttribute : Attribute
{
- private string description;
- public string Description { get { return Description; } }
+ private readonly string description;
+ public string Description { get { return description; } }
public DescriptionAttribute(string description)
{

MODIFY
src/Chapter18/Chapter18.csproj
src/Chapter18/Chapter18.csproj
<PropertyGroup>
<!-- CS0612 is an Obsolete warning demonstrating the Obsolete attribute -->
<ExpectedWarnings>$(ExpectedWarnings),CS0612</ExpectedWarnings>
+ <!--CS0612 Mark attributes with AttributeUsageAttribute, isn't shown until 18.19-->
+ <IgnoredWarnings>$(IgnoredWarnings),CA1018</IgnoredWarnings>
</PropertyGroup>
<Import Project="..\Chapter.props" />
<ItemGroup>
<EmbeddedResource Remove="4.0\**" />
<None Remove="4.0\**" />
<Compile Remove="Listing18.10.AssemblyAttributesWithinAssemblyInfo.cs" />
+ <Compile Remove="Listing18.11.SpecifyingAReturnAttribute.cs" />
<Compile Remove="Listing18.12.csprojMockFileForResequencingListings.cs" />
<Compile Remove="Listing18.30.OverridableMembersOnSystem.Dynamic.DynamicObject.cs" />
<Compile Include="..\Shared\Program.cs">
<Link>DoWorkEventArgs.cs</Link>
</Compile>
<None Include="Listing18.10.AssemblyAttributesWithinAssemblyInfo.cs" />
- <None Include="Listing18.12.csproj" />
+ <None Include="Listing18.11.SpecifyingAReturnAttribute.cs" />
<None Include="Listing18.30.OverridableMembersOnSystem.Dynamic.DynamicObject.cs" />
</ItemGroup>
</Project>

MODIFY
src/Chapter18/Listing18.08.DecoratingAPropertyWithAnAttribute.cs
src/Chapter18/Listing18.08.DecoratingAPropertyWithAnAttribute.cs
@@ -16,17 +16,18 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_08
}
-
+ // Disabling warning since it is not implemented or shown in manuscript
+ #pragma warning disable CA1018 // Mark attributes with AttributeUsageAttribute
internal class CommandLineSwitchRequiredAttribute : Attribute
{
- //not implimented
+ //not implemented
}
internal class CommandLineSwitchAliasAttribute : Attribute
{
public CommandLineSwitchAliasAttribute(string _)
{
- //not implimented
+ //not implemented
}
}
}
\ No newline at end of file

MODIFY
src/Chapter18/Listing18.09.DecoratingAPropertyWithMultipleAttributes.cs
src/Chapter18/Listing18.09.DecoratingAPropertyWithMultipleAttributes.cs
@@ -19,6 +19,8 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_09
System.Diagnostics.ProcessPriorityClass.Normal;
}
+ // Disabling warning since it is not implemented or shown in manuscript
+ #pragma warning disable CA1018 // Mark attributes with AttributeUsageAttribute
internal class CommandLineSwitchRequiredAttribute : Attribute
{
//not implimented
@@ -31,5 +33,4 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_09
//not implimented
}
}
-
}

MODIFY
src/Chapter18/Listing18.29.ImplementingACustomDynamicObject.cs
src/Chapter18/Listing18.29.ImplementingACustomDynamicObject.cs
@@ -27,7 +27,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_29
Element.Descendants(binder.Name).First();
if(firstDescendant != null)
{
- if(firstDescendant.Descendants().Count() > 0)
+ if(firstDescendant.Descendants().Any())
{
result = new DynamicXml(firstDescendant);
}

Warnings through Chapter 18