static public ExtraSuggestionInfo ForObjectInvariant(string suggestedCode, string typeDocumentID) { Contract.Requires(suggestedCode != null); Contract.Requires(typeDocumentID != null); Contract.Ensures(Contract.Result<ExtraSuggestionInfo>() != null); var result = new ExtraSuggestionInfo(); result.SuggestedCode = suggestedCode; result.TypeDocumentId = typeDocumentID; return result; }
static public ExtraSuggestionInfo ForObjectInvariant(string suggestedCode, string typeDocumentID) { Contract.Requires(suggestedCode != null); Contract.Requires(typeDocumentID != null); Contract.Ensures(Contract.Result <ExtraSuggestionInfo>() != null); var result = new ExtraSuggestionInfo(); result.SuggestedCode = suggestedCode; result.TypeDocumentId = typeDocumentID; return(result); }
public static ExtraSuggestionInfo FromStream(IEnumerable <string> enumerable) { Contract.Ensures(Contract.Result <ExtraSuggestionInfo>() != null); if (enumerable == null) { return(new ExtraSuggestionInfo()); } var fields = new List <string>(); var values = new List <string>(); var count = 0; foreach (var str in enumerable) { if (count % 2 == 0) { fields.Add(str); } else { values.Add(str); } count++; } if (fields.Count != values.Count) { return(ExtraSuggestionInfo.None); } var freshObj = new ExtraSuggestionInfo(); var type = typeof(ExtraSuggestionInfo); for (var i = 0; i < fields.Count; i++) { var fi = type.GetField(fields[i], PublicInstances()); Contract.Assume(fi != null); fi.SetValue(freshObj, values[i]); } return(freshObj); }
public static ExtraSuggestionInfo FromStream(IEnumerable<string> enumerable) { Contract.Ensures(Contract.Result<ExtraSuggestionInfo>() != null); if (enumerable == null) return new ExtraSuggestionInfo(); var fields = new List<string>(); var values = new List<string>(); var count = 0; foreach (var str in enumerable) { if (count % 2 == 0) fields.Add(str); else values.Add(str); count++; } if (fields.Count != values.Count) { return ExtraSuggestionInfo.None; } var freshObj = new ExtraSuggestionInfo(); var type = typeof(ExtraSuggestionInfo); for (var i = 0; i < fields.Count; i++) { var fi = type.GetField(fields[i], PublicInstances()); Contract.Assume(fi != null); fi.SetValue(freshObj, values[i]); } return freshObj; }