Ejemplo n.º 1
0
    public static void Main()
    {
        Assembly assem = typeof(Example).Assembly;

        foreach (Type typ in assem.GetTypes())
        {
            object[] typeAttribs = typ.GetCustomAttributes(typeof(ComponentGuaranteesAttribute), true);
            if (typeAttribs.Length > 0)
            {
                ComponentGuaranteesAttribute guaranteeAttrib = (ComponentGuaranteesAttribute)typeAttribs[0];
                ComponentGuaranteesOptions   guarantee       = guaranteeAttrib.Guarantees;
                // Test whether guarantee is Exchange.
                if ((guarantee & ComponentGuaranteesOptions.Exchange) == ComponentGuaranteesOptions.Exchange)
                {
                    Console.WriteLine("{0} is marked as {1}.", typ.Name, guarantee);
                }
                // <Snippet1>
                // Test whether guarantee is Stable.
                if ((guarantee & ComponentGuaranteesOptions.Stable) == ComponentGuaranteesOptions.Stable)
                {
                    Console.WriteLine("{0} is marked as {1}.", typ.Name, guarantee);
                }
                // </Snippet1>
                // <Snippet2>
                // Test whether guarantee is Stable or Exchange.
                if ((guarantee & (ComponentGuaranteesOptions.Stable | ComponentGuaranteesOptions.Exchange)) > 0)
                {
                    Console.WriteLine("{0} is marked as Stable or Exchange.", typ.Name, guarantee);
                }
                // </Snippet2>
                // <Snippet3>
                // Test whether there is no guarantee (neither Stable nor Exchange).
                if ((guarantee & (ComponentGuaranteesOptions.Stable | ComponentGuaranteesOptions.Exchange)) == 0)
                {
                    Console.WriteLine("{0} has no compatibility guarantee.", typ.Name, guarantee);
                }
                // </Snippet3>
            }
        }
    }
Ejemplo n.º 2
0
 public ComponentGuaranteesAttribute(ComponentGuaranteesOptions guarantees)
 {
     Guarantees = guarantees;
 }
		public ComponentGuaranteesAttribute (ComponentGuaranteesOptions guarantees)
		{
			this.guarantees = guarantees;
		}
Ejemplo n.º 4
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Versioning.ComponentGuaranteesAttribute" /> class with a value that indicates a library, type, or member's guaranteed level of compatibility across multiple versions.</summary><param name="guarantees">One of the enumeration values that specifies the level of compatibility that is guaranteed across multiple versions.</param>
 public ComponentGuaranteesAttribute(ComponentGuaranteesOptions guarantees)
 {
     throw new NotImplementedException();
 }
 public ComponentGuaranteesAttribute(ComponentGuaranteesOptions guarantees)
 {
 }