예제 #1
0
 public Parameters(params Parameter[] parameters)
 {
     if (parameters.Select(x => x.Code).Distinct(StringComparer.OrdinalIgnoreCase).Count() != parameters.Length)
     {
         throw new ArgumentException("Parameter codes are not unique");
     }
     _parameters.AddRange(parameters);
 }
예제 #2
0
파일: MemberSet.cs 프로젝트: zyhong/Spreads
        internal MemberSet(Type type)
        {
            const BindingFlags PublicInstance = BindingFlags.Public | BindingFlags.Instance;

#if NET20
            RefList <MemberInfo> properties = new RefList <MemberInfo>(type.GetProperties(PublicInstance));
            properties.AddRange(new RefList <MemberInfo>(type.GetFields(PublicInstance)));
            properties.Sort((p1, p2) => p1.Name.CompareTo(p2.Name));
            members = properties.ConvertAll <Member>(mi => new Member(mi)).ToArray();
#else
            members = type.GetProperties(PublicInstance).Cast <MemberInfo>()
                      .Concat(type.GetFields(PublicInstance).Cast <MemberInfo>())
                      .OrderBy(x => Marshal.OffsetOf(type, x.Name).ToInt32())
                      .Select(member => new Member(member)).ToArray();
#endif
        }
예제 #3
0
 public override void DeserializeRefList(GenericReader reader)
 {
     RefList.AddRange(reader.ReadStrongGuildList());
 }