Example #1
0
        public List <T> GetAllRecordsByType <T>() where T : BiffRecord
        {
            RecordType rt;

            if (RecordType.TryParse(typeof(T).Name, out rt))
            {
                return(GetAllRecordsByType(rt).Select(r => (T)r.AsRecordType <T>()).ToList());
            }
            //Special edge case for the String BIFF record since it overlaps with the c# string keyword
            else if (typeof(T).Name.Equals("STRING"))
            {
                rt = RecordType.String;
                return(GetAllRecordsByType(rt).Select(r => (T)r.AsRecordType <T>()).ToList());
            }

            throw new ArgumentException(string.Format("Could not identify matching RecordType for class {0}",
                                                      typeof(T).Name));
        }