Ancestry.QueryProcessor.Type.TupleType.GetKeyAttributes C# (CSharp) Méthode

GetKeyAttributes() public méthode

public GetKeyAttributes ( ) : IEnumerable
Résultat IEnumerable
        public IEnumerable<Name> GetKeyAttributes()
        {
            if (Keys.Count == 0)
            {
                foreach (var a in Attributes)
                    yield return a.Key;
            }
            else
            {
                // Return distinct set of all attributes from all keys
                var attributes = new HashSet<Name>();
                foreach (var k in Keys)
                    foreach (var an in k.AttributeNames)
                    {
                        if (attributes.Add(an))
                            yield return an;
                    }
            }
        }

Usage Example

Exemple #1
0
        private static MethodBuilder EmitTupleGetHashCode(TupleType tupleType, TypeBuilder typeBuilder, Dictionary<Name, FieldInfo> fieldsByID)
        {
            var getHashCodeMethod = typeBuilder.DefineMethod("GetHashCode", MethodAttributes.Virtual | MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot, CallingConventions.HasThis, typeof(Int32), new System.Type[] { });
            var il = getHashCodeMethod.GetILGenerator();
            // result = 83
            il.Emit(OpCodes.Ldc_I4, 83);
            foreach (var keyItem in tupleType.GetKeyAttributes())
            {
                var field = fieldsByID[keyItem];

                // result ^= this.<field>.GetHashCode();
                il.Emit(OpCodes.Ldarg_0);
                il.Emit(OpCodes.Ldflda, field);
                il.Emit(OpCodes.Constrained, field.FieldType);
                il.EmitCall(OpCodes.Callvirt, ReflectionUtility.ObjectGetHashCode, null);
                il.Emit(OpCodes.Xor);
            }
            il.Emit(OpCodes.Ret);
            typeBuilder.DefineMethodOverride(getHashCodeMethod, ReflectionUtility.ObjectGetHashCode);
            return getHashCodeMethod;
        }
All Usage Examples Of Ancestry.QueryProcessor.Type.TupleType::GetKeyAttributes