本文整理汇总了C#中DataType.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# DataType.Equals方法的具体用法?C# DataType.Equals怎么用?C# DataType.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataType
的用法示例。
在下文中一共展示了DataType.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataTypeNotEqualsWrongType
public void DataTypeNotEqualsWrongType()
{
var dataType = new DataType(SqlDbType.VarChar);
bool actual = dataType.Equals(string.Empty);
Assert.IsFalse(actual);
}
示例2: DataTypeEqualsObject
public void DataTypeEqualsObject()
{
var dataTypeA = new DataType(SqlDbType.VarChar);
var dataTypeB = new DataType(SqlDbType.VarChar);
bool actual = dataTypeA.Equals((object)dataTypeB);
Assert.IsTrue(actual);
}
示例3: Parse
internal string Parse(string args, DataType dataType, bool disableSpeech) {
if (args.Contains("{mute}") || args.Contains("{widget}")) {
args = args.Replace("{mute}", string.Empty).Replace("{widget}", string.Empty);
disableSpeech = true;
}
if (args.Contains("</lock>")) // lock is extension of judo parser. No need for extra parsing
if (dataType.Equals(DataType.html))
return Judoers.JudoParser(args).Replace("\r", string.Empty).Replace("\n", "<br />");
else
return Judoers.JudoParser(args);
string[] InstructionSets = args.Split(';');
var results = new Dictionary<string, KeyValuePair<string, string>>();
foreach (string Instruction in InstructionSets)
if (Instruction.Trim() != string.Empty) {
var exe = Execute(Instruction.Trim(), disableSpeech).Replace("\r", string.Empty);
if (exe.EndsWith("\n"))
exe = exe.Substring(0, exe.LastIndexOf("\n"));
var key = Instruction.Trim().Replace(" ", "_").Replace("%", string.Empty);
try {
results.Add(key, new KeyValuePair<string, string>(Instruction.Trim(), exe));
}
catch {
// Duplicate keys are not allowed.
}
}
switch (dataType) {
case DataType.html:
return results.ToDebugString().Replace("<", "<").Replace(">", ">").Replace("\n", "<br />");
case DataType.json:
return results.ToJson();
}
return results.ToDebugString();
}
示例4: DataTypesAreEqual
private bool DataTypesAreEqual(DataType dataType1, DataType dataType2)
{
var primitive1 = dataType1 as PrimitiveDataType;
var collection1 = dataType1 as CollectionDataType;
var rowDataType1 = dataType1 as RowDataType;
if (primitive1 != null)
{
var primitive2 = dataType2 as PrimitiveDataType;
if (primitive2 == null)
{
return false;
}
primitive1 = this.CompensatePrimitiveDefaultFacets(primitive1);
primitive2 = this.CompensatePrimitiveDefaultFacets(primitive2);
return primitive1.Equals(primitive2);
}
else if (collection1 != null)
{
var collection2 = dataType2 as CollectionDataType;
if (collection2 == null)
{
return false;
}
return this.DataTypesAreEqual(collection1.ElementDataType, collection2.ElementDataType);
}
else if (rowDataType1 != null)
{
var rowDataType2 = dataType2 as RowDataType;
if (rowDataType2 == null || rowDataType1.Definition.Properties.Count() != rowDataType2.Definition.Properties.Count())
{
return false;
}
foreach (var propertyType1 in rowDataType1.Definition.Properties)
{
var propertyType2 = rowDataType2.Definition.Properties.SingleOrDefault(n => n.Name == propertyType1.Name && this.DataTypesAreEqual(propertyType1.PropertyType, n.PropertyType));
if (propertyType2 == null)
{
return false;
}
}
return true;
}
else
{
return dataType1.Equals(dataType2);
}
}