CSharpSourceEmitter.SourceEmitter.SortAttributes C# (CSharp) Method

SortAttributes() public static method

public static SortAttributes ( IEnumerable attributes ) : IEnumerable
attributes IEnumerable
return IEnumerable
    public static IEnumerable<ICustomAttribute> SortAttributes(IEnumerable<ICustomAttribute> attributes) {
      List<ICustomAttribute> attrs = new List<ICustomAttribute>(attributes);
      //Attribute tokens are not stable under repeated compilation of the same source, so we'll sort by attribute type name.
      //This is not stable when multiple attributes of the same type are present, but it should be good enough for repeatable tests.
      attrs.Sort(new Comparison<ICustomAttribute>((a1, a2) => {
        return string.CompareOrdinal(TypeHelper.GetTypeName(a1.Type), TypeHelper.GetTypeName(a2.Type));
      }));

      return attrs;
    }
SourceEmitter