本文整理汇总了C#中DataType类的典型用法代码示例。如果您正苦于以下问题:C# DataType类的具体用法?C# DataType怎么用?C# DataType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataType类属于命名空间,在下文中一共展示了DataType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataTypeValidator
public DataTypeValidator(DataType dataType, object data)
{
m_dataType = dataType;
m_data = data;
SetActualDataType();
}
示例2: PyBuildValueFormatParser
public PyBuildValueFormatParser(
Program program,
Address addrInstr,
string format,
IServiceProvider services)
{
this.ArgumentTypes = new List<DataType>();
this.format = format;
var platform = program.Platform;
this.pointerSize = platform.PointerType.Size;
var wordSize = platform.Architecture.WordWidth.Size;
var longSize = platform.GetByteSizeFromCBasicType(
CBasicType.Long);
var longLongSize = platform.GetByteSizeFromCBasicType(
CBasicType.LongLong);
var doubleSize = platform.GetByteSizeFromCBasicType(
CBasicType.Double);
dtInt = Integer(wordSize);
dtUInt = UInteger(wordSize);
dtLong = Integer(longSize);
dtULong = UInteger(longSize);
dtLongLong = Integer(longLongSize);
dtULongLong = UInteger(longLongSize);
dtDouble = Real(doubleSize);
ptrChar = Ptr(PrimitiveType.Char);
ptrVoid = Ptr(VoidType.Instance);
dtPySize = UInteger(pointerSize);
ptrPyObject = Ptr(Ref("PyObject"));
ptrPyUnicode = Ptr(Ref("Py_UNICODE"));
ptrPyComplex = Ptr(Ref("Py_complex"));
ptrPyConverter = Ptr(new CodeType());
}
示例3: DataTypeGraphModel
public DataTypeGraphModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, DiagramViewModel parent,
DataType obj)
: base(appCtx, dataCtx, parent, obj)
{
this._diagMdl = parent;
this.DataType = obj;
}
示例4: Unify
public IEnumerable<string> Unify(DataType a, DataType b)
{
a = Normalize(a);
b = Normalize(b);
if (a is TypeVariable)
{
var variableA = (TypeVariable)a;
if (b.Contains(variableA))
{
if (a != b)
return Error(a, b);
return success;
}
substitutions[variableA] = b;
return success;
}
if (b is TypeVariable)
return Unify(b, a);
if (a.Name != b.Name)
return Error(a, b);
if (a.GenericArguments.Count() != b.GenericArguments.Count())
return Error(a, b);
return PairwiseUnify(a.GenericArguments, b.GenericArguments);
}
示例5: DataTypeAttribute
public DataTypeAttribute(DataType dataType)
{
this.DataType = dataType;
this.InitializeDefaultErrorMessage();
switch (this.DataType)
{
case DataType.Boolean:
this.UsesCustomValidation = true;
break;
case DataType.Alphabetic:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = AlphabeticMatcher.ToString();
break;
case DataType.AlphaNumeric:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = AlphaNumericMatcher.ToString();
break;
case DataType.PhoneNumber:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = PhoneNumberMatcher.ToString();
break;
case DataType.ZipCode:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = ZipCodeMatcher.ToString();
break;
case DataType.EmailAddress:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = EmailMatcher.ToString();
break;
case DataType.IpAddress:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = IpAddressMatcher.ToString();
break;
case DataType.Url:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = UrlCodeMatcher.ToString();
break;
case DataType.CreditCard:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = CreditCardMatcher.ToString();
break;
case DataType.CreditCardLuhn:
this.UsesCustomValidation = true;
break;
case DataType.SocialSecurityNumber:
this.UsesRegularExpression = true;
this.CurrentRegularExpression = SocialSecurityMatcher.ToString();
break;
}
}
示例6: DataTypeInfo
/// <summary>
/// Initializes a new instance of the <see cref="DataTypeInfo" /> class.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="rules">The rules.</param>
/// <exception cref="NotSupportedException"></exception>
public DataTypeInfo(DataType type, IEnumerable<RuleMap> rules)
{
switch (type)
{
case DataType.Text:
Description = "Text";
break;
case DataType.Number:
Description = "Number";
break;
case DataType.Date:
Description = "Date";
break;
case DataType.Group:
Description = "Group";
break;
case DataType.Transform:
Description = "Transform";
break;
default:
//this stops any undefined data type being added
throw new NotSupportedException();
}
DataType = type;
RuleTypes =
rules.Select(
arg =>
new RuleTypeInfo(type, arg))
.ToList();
}
示例7: Ident
public Ident(string name, IdentType identType, DataType dataType, AstNode node)
{
Name = name;
IdentType = identType;
DataType = dataType;
Node = node;
}
示例8: Update
public void Update(int fieldId, DataType type)
{
var types = type.FieldSettingTypes.Where(t => t.Section == Section).ToArray();
for (var i = 0; i < types.Count(); i++)
{
var value = string.Empty;
var t = types[i].SystemType;
if (t == "Boolean")
{
var cb = Repeater1.Controls[i].FindControl("Checkbox") as CheckBox;
if (cb != null) value = cb.Checked.ToString(CultureInfo.InvariantCulture);
}
else
{
var tb = Repeater1.Controls[i].FindControl("Textbox") as TextBox;
if (tb != null) value = tb.Text;
}
if (t == "Int")
{
value = value.AsInt().ToString(CultureInfo.InvariantCulture);
}
var key = types[i].Key;
if (types[i].VerifySetting (value))
FieldSettingsController.UpdateFieldSetting(key, value, fieldId);
}
}
示例9: DataLoadException
/// <summary>
/// Creates a new instance of the <see cref="DataLoadException"/> class.
/// </summary>
/// <param name="inner">The inner exception.</param>
/// <param name="jsonData">The data that the serializer was trying to load.</param>
/// <param name="targetType">The target type.</param>
public DataLoadException(Exception inner, string jsonData, Type targetType, DataType dataType)
: base("An exception occurred trying to read data into an internal format. Please check that the input data is correct.", inner)
{
Data.Add("Target type", targetType.Name);
Data.Add("Data type", dataType.ToString());
Data.Add("Data", jsonData);
}
示例10: Show
public void Show(DataType selectedType)
{
TypeName = selectedType.Name;
SelectedType = selectedType;
Repeater1.DataSource = selectedType.FieldSettingTypes.Where(t=>t.Section==Section);
Repeater1.DataBind();
}
示例11: BindData
public void BindData(int fieldId,DataTable settingsTable, DataType type)
{
if (!IsPostBack)
{
var types = type.FieldSettingTypes.Where(t => t.Section == Section).ToArray();
for (var i = 0; i < types.Count(); i++)
{
var key = types[i].Key;
var value = settingsTable.GetFieldSetting(key, fieldId);
if (!string.IsNullOrEmpty(value))
{
var t = type.FieldSettingTypes.ElementAt(i).SystemType;
if (t == "Boolean")
{
var cb = Repeater1.Controls[i].FindControl("Checkbox") as CheckBox;
if (cb != null) cb.Checked = value.AsBoolean();
}
else
{
var tb = Repeater1.Controls[i].FindControl("Textbox") as TextBox;
if (tb != null) tb.Text = value;
}
}
}
}
}
示例12: DefaultMethods
public DefaultMethods(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, DataType dt)
: base(_host)
{
this.ctx = ctx;
this.dt = dt;
}
示例13: Event
public Event(Controller controller, DataType type, string name, string modifier)
: base(controller)
{
Name = name;
DataType = type;
_Modifiers.Add(modifier);
}
示例14: Input
public Input(string name, DataType type= DataType.Text, bool isOptional=false)
{
Id = Guid.NewGuid().ToString();
Name = name;
Type = type;
IsOptional = isOptional;
}
示例15: DatabaseFunctionParameter
/// <summary>
/// Initializes a new instance of the DatabaseFunctionParameter class with given name, type and mode.
/// </summary>
/// <param name="name">Parameter name</param>
/// <param name="type">Parameter type</param>
/// <param name="mode">Parameter mode.</param>
public DatabaseFunctionParameter(string name, DataType type, DatabaseParameterMode mode)
{
this.Name = name;
this.ParameterType = type;
this.Mode = mode;
this.Annotations = new List<Annotation>();
}