private static int SerializeOVT(XElement xNode) { Contract.Requires(xNode.Attribute("otype") != null); OVT vid = OVT.iri; Contract.Requires(OVT.TryParse(xNode.Attribute("otype").Value, out vid)); return((int)vid); }
/// <summary> /// Мектод со спецаильной сигнатурой для встроенного в C# 7 "синтаксического сахара" /// object[] someArray= new object[]{ 5, 7, "sddd"}; /// В следующей строчке вызывается метод Deconstruct(someArray, out object element1, out object element2, out object element3) /// (object x, object y, object z) = someArray; /// </summary> /// <param name="array"></param> /// <param name="element1"></param> /// <param name="element2"></param> public static void Deconstruct(this object[] array, out OVT element1, out object element2) { element1 = (OVT)(int)array[0]; element2 = array[1]; }
public SparqlTriple( string sVar = null, string pVar = null, string oVar = null, string subjectSource = null, string predicateSource = null, string objectSource = null, OVT objectType = OVT.iri, int?subject = null, int?predicate = null, object[] o = null) { this.subjectSource = subjectSource; this.predicateSource = predicateSource; this.subjectVarName = sVar; this.predicateVarName = pVar; this.objectVarName = oVar; if (sVar != null) { this.isSubjectVariable = true; this.variables.Add(sVar); } else { this.isSubjectVariable = false; if (subject != null) { this.subject = subject.Value; this.isSubjectCoded = true; } else if (subjectSource != null) { this.subjectSource = subjectSource; this.isSubjectCoded = false; } else { throw new AggregateException(); } } if (pVar != null) { this.isPredicateVariable = true; this.variables.Add(pVar); } else { this.isPredicateVariable = false; if (predicate != null) { this.predicate = predicate.Value; this.isPredicateCoded = true; } else if (predicateSource != null) { this.predicateSource = predicateSource; this.isPredicateCoded = false; } else { throw new AggregateException(); } } if (oVar != null) { this.isObjectVariable = true; this.variables.Add(oVar); } else { this.isObjectVariable = false; if (o != null) { this._object = o; } else if (objectSource != null) { this._object = new object[] { objectType, objectSource }; } else { throw new AggregateException(); } } }