Example #1
0
        static PropertyIndex ParseIndex(string Index)
        {
            PropertyIndex pIndex = new PropertyIndex();

            List<Type> pTypes = new List<Type>();
            List<object> pValues = new List<object>();

            int indexValue = 0;
            string[] Indexes = Index.Split(',');
            for (int i = 0; i < Indexes.Length; i++)
            {
                if (Indexes[i] == "")
                {
                    continue;
                }
                else if (int.TryParse(Indexes[i], out indexValue))
                {
                    pTypes.Add(typeof(int));
                    pValues.Add(indexValue);
                }
                else if (Indexes[i].StartsWith("'") && Indexes[i].EndsWith("'"))
                {
                    pTypes.Add(typeof(string));
                    pValues.Add(
                        Indexes[i].Substring(1, Indexes[i].Length - 2)
                        );
                }
                else
                {
                    throw new Exception(
                        string.Format("Parse Error On Index[{0}]@[{1}]", Indexes[i], Index)
                        );
                }
            }

            pIndex.Types = pTypes.ToArray();
            pIndex.Value = pValues.ToArray();

            return pIndex;
        }
 public void Given()
 {
     _index = new PropertyIndex<Foo>(_fs, _path, "AwesomeIndex", f => new { f.Name });
     _index.Inspect(5, new Foo { Name = "Arthur" });
 }