本文整理汇总了C#中System.Factory.create方法的典型用法代码示例。如果您正苦于以下问题:C# Factory.create方法的具体用法?C# Factory.create怎么用?C# Factory.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Factory
的用法示例。
在下文中一共展示了Factory.create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConjugationTable
void ILoader.loadDico(LanguageDictionary dico, Factory factory)
{
// chargement du dico à partir d'une base SQLite
// -- chargement des mots ---------------------------------------
List<Dictionary<string, object>> words = this.db.select("words", new string[] { "word", "type", "attributs", "definition" });
for (int i = 0; i < words.Count; i++)
{
string w = (string)words[i]["word"];
string t = (string)words[i]["type"];
string a = (string)words[i]["attributs"];
string d = (string)words[i]["definition"];
if (a == null) a = "";
if (d == null) d = "";
Word word = factory.create(w, t, a.Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries), d);
if (word.IsTypeOf(typeof(VerbType)))
{
//charger la table de conjugaison
Word[] verbsConjugated = this.getConjugatedVerbsFor(word.word, factory);
ConjugationTable table = new ConjugationTable(word);
table.AddRange(verbsConjugated); // ajout des verbes à la table de conjugaison
dico.conjugaisonTables.Add(table); // ajout de la table de conjugaison au dictionnaire
dico.AddRange(verbsConjugated); // ajout des verbes au dictionnaire
}
dico.Add(word);
}
}
示例2: getConjugatedVerbsFor
private Word[] getConjugatedVerbsFor(string v, Factory factory)
{
List<Dictionary<string, object>> verbsRaw = this.db.select("conjugated_verbs", new string[] { "mood", "tense", "person", "word" }, new string[] { "base='" + v + "'" });
List<Word> verbs = new List<Word>();
for (int i = 0; i < verbsRaw.Count; i++)
{
int m = (int)((decimal)verbsRaw[i]["mood"]);
int t = (int)((decimal)verbsRaw[i]["tense"]);
int p = (int)((decimal)verbsRaw[i]["person"]);
string w = (string)verbsRaw[i]["word"];
verbs.Add(factory.create(w, "verb", new string[] { m.ToString(), t.ToString(), p.ToString() }, ""));
}
return verbs.ToArray();
}