本文整理汇总了C#中DataType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DataType.ToString方法的具体用法?C# DataType.ToString怎么用?C# DataType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataType
的用法示例。
在下文中一共展示了DataType.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddColumn
public void AddColumn(TableConf t, string dbName, string columnName, DataType dataType, string historyDB)
{
// NOTE: We changed the signature of this method to use "DataType dataType" instead of "string dataType"
// but currently, we are still using the generic DataType.MapDataType(), passing in dataType.ToString().
// The generic DataType.MapDataType() method is likely to have problem mapping source column data types to
// destination (in this case, Netezza) column data types. We should implement a MapColumnTypeName() method
// within this DataUtil class to handle the specific column data type mapping from different sources to Netezza.
// Check out VerticaDataUtil for an example.
columnName = MapReservedWord(columnName);
if (!CheckColumnExists(dbName, t.SchemaName, t.Name, columnName)) {
//The "max" string doesn't exist on netezza, we can just replace it with the NetezzaStringLength after mapping it.
//In practice this only impacts varchar and nvarchar, since other data types would be mapped to something else by the MapDataType
//function (i.e. varbinary). This is the only place we do this special string-based handling because we wanted to keep Netezza specific logic
//out of the DataType class. Outside of this case, the "max" is handled appropriately in the netezza data copy class.
string destDataType = DataType.MapDataType(Config.RelayType, SqlFlavor.Netezza, dataType.ToString()).Replace("max", Config.NetezzaStringLength.ToString());
string sql = string.Format("ALTER TABLE {0} ADD {1} {2}; GROOM TABLE {0} VERSIONS;", t.Name, columnName, destDataType);
var cmd = new OleDbCommand(sql);
SqlNonQuery(dbName, cmd);
RefreshViews(dbName, t.Name);
}
if (t.RecordHistoryTable && CheckTableExists(historyDB, t.HistoryName, t.SchemaName) && !CheckColumnExists(historyDB, t.SchemaName, t.HistoryName, columnName)) {
string sql = string.Format("ALTER TABLE {0} ADD {1} {2}; GROOM TABLE {0} VERSIONS;", t.HistoryName, columnName, dataType.ToString());
var cmd = new OleDbCommand(sql);
logger.Log("Altering history table column with command: " + cmd.CommandText, LogLevel.Debug);
SqlNonQuery(historyDB, cmd);
RefreshViews(historyDB, t.HistoryName);
}
}
示例2: GetLegend
public string GetLegend(DataType dataType,string MapType)
{
if (dataType == DataType.Road||dataType==DataType.BusLine)
{
return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data/" + dataType.ToString() + MapType + ".png");
}else if (dataType == DataType.People)
{
return string.Empty;
}
else
{
return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data/" + dataType.ToString() + ".png");
}
}
示例3: 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);
}
示例4: GetImage
/// <summary>
/// Returns a full-size or scaled image given its URI. Input parameters include resolution. This is the only command that should return
/// </summary>
/// <param name="fileUri">URI of the target file. Manufacturers decide whether to use absolute or relative URIs. Clients may treat this as an opaque identifier.</param>
/// <param name="type">enum DataType { full, thumb }</param>
/// <param name="callback">Action<byte[], Error></param>
public void GetImage(string fileUri, DataType type, Action<byte[], Error> callback)
{
CommandRequest request = new CommandRequest("camera.getImage");
request.AddParameter("fileUri", fileUri);
request.AddParameter("_type", type.ToString());
CommandExecute(request, (response) =>
{
callback(response.bytes, response.error);
});
}
示例5: AddLogMessage
public static void AddLogMessage(DataType dataType, Files.FileOperationResult fileResult, bool isSave)
{
//自動バックアップを開始します
//[読込]config : 成功 (2015/6/1 13:12:05)
//[保存]config : 成功 (2015/6/1 13:12:07)
//[保存]Material : 失敗 ErrorReason (2015/6/1 13:12:75)
string mode = isSave ? "保存" : "読込";
string issuccess = fileResult.IsSuccess ? "成功" : "失敗";
string str = string.Format("[{0}]{1} : {2} {3} ({4})",
mode, dataType.ToString(), issuccess,
fileResult.ErrorReason, DateTime.Now.ToString());
LogMessage.Add(str);
}
示例6: CreateArgumentParser
public virtual ArgumentParser CreateArgumentParser(DataType dataType)
{
switch (dataType)
{
case DataType.Integer:
return new IntArgumentParser();
case DataType.Boolean:
return new BoolArgumentParser();
case DataType.Decimal:
return new DoubleArgumentParser();
default:
throw new InvalidOperationException("non supported argument parser type " + dataType.ToString());
}
}
示例7: MakeDatabaseClient
public static IDatabase MakeDatabaseClient(DataType dataType)
{
IDatabase dataClient = null;
try
{
Type type = Type.GetType("ToolsLib.Data.Client." + dataType.ToString());
dataClient = (IDatabase)Activator.CreateInstance(type, false);
}
catch (Exception ex)
{
_sMessage = ex.Message;
_bResult = false;
}
return dataClient;
}
示例8: GetConfigKey
/// <summary>
/// 依赖CustomSetting,名称定义格式为
/// AlipayKey=key
/// AlipayUser=user
/// [email protected]
/// </summary>
/// <param name="companyType"></param>
/// <param name="type"></param>
/// <returns></returns>
public static string GetConfigKey(CompanyType companyType,DataType type)
{
string key = companyType + type.ToString();
//if (accountKeys.Count == 0)
//{
// string file = System.Web.Hosting.HostingEnvironment.MapPath("/charge/charge.config");
// string content = System.IO.File.ReadAllText(file);
// string entryKey = "S8S7FLDL";
// content = CoreHelper.StringHelper.Decrypt(content, entryKey);
// string[] arry = content.Split('\n');
// foreach (string str in arry)
// {
// string[] arry1 = str.Trim().Split('=');
// accountKeys.Add(new KeySetting() { Key = arry1[0], Value = arry1[1] });
// }
//}
//KeySetting set = accountKeys.Find(b => b.Key.ToUpper() == key.ToUpper());
//if (set != null)
// return set.Value;
string result = CoreHelper.CustomSetting.GetConfigKey(key);
return result;
}
示例9: ValveDataType
private static string ValveDataType(DataType type)
{
switch (type)
{
case DataType.SByte: return "int8";
case DataType.Byte: return "uint8";
case DataType.Int16: return "int16";
case DataType.UInt16: return "uint16";
case DataType.Int32: return "int32";
case DataType.UInt32: return "uint32";
case DataType.Int64: return "int64";
case DataType.UInt64: return "uint64";
case DataType.Float: return "float32";
case DataType.String: return "CResourceString";
case DataType.Boolean: return "bool";
case DataType.Fltx4: return "fltx4";
case DataType.Matrix3x4a: return "matrix3x4a_t";
}
return type.ToString();
}
示例10: ValidateSupportedDataTypes
private DTSValidationStatus ValidateSupportedDataTypes(DataType dataType)
{
if (dataType == DataType.DT_BYTES ||
dataType == DataType.DT_IMAGE)
{
this.PostError(MessageStrings.UnsupportedDataType(dataType.ToString()));
return DTSValidationStatus.VS_ISCORRUPT;
}
else
{
return DTSValidationStatus.VS_ISVALID;
}
}
示例11: Send
public void Send( DataType type, object data )
{
switch (type) {
case DataType.CHARMESSAGE:
ForwardCharMessage(data);
break;
case DataType.DEATH:
ForwardDeath(data);
break;
case DataType.FIRE:
ForwardFire(data);
break;
case DataType.JOINGAME:
ForwardRoomJoinRequest(data);
break;
case DataType.MAKEGAME:
ForwardRoomRequest(data);
break;
case DataType.SPAWNED:
ForwardSpawned(data);
break;
case DataType.TRANSFORM:
ForwardTransform(data);
break;
case DataType.SHOOT:
break;
case DataType.POWERUP:
Debug.Log("Current Powerup in Play: " + (string)data);
break;
default:
Debug.LogError("Unhandled DataType: " + type.ToString());
break;
}
}
示例12: ConvertToAdodbDataType
private static DataTypeEnum ConvertToAdodbDataType(DataType dataType)
{
return (DataTypeEnum)Enum.Parse(typeof(DataTypeEnum), dataType.ToString());
}
示例13: CreatePercentCounterData
private PerformanceCounterData CreatePercentCounterData(DataType type,string instanceName)
{
string key = type.ToString() + instanceName;
switch (type)
{
case DataType.ProcessorLoadPercent:
if (!this.performanceCounters.ContainsKey(key))
{
PerformanceCounterData pcd = new PerformanceCounterData(new PerformanceCounter[] { new PerformanceCounter("Processor", "% Processor Time", instanceName) }, type, GetDataType.Percent, instanceName,new object[] { 100 });
pcd.CountHandle += this.PercentCounterHandler;
this.performanceCounters.Add(key, pcd);
return pcd;
}
return this.performanceCounters[key];
case DataType.MemoryLoadPercent:
if (!this.performanceCounters.ContainsKey(key))
{
PerformanceCounterData pcd = new PerformanceCounterData(new PerformanceCounter[]{new PerformanceCounter("Memory", "Available KBytes")}, type,GetDataType.Available,instanceName,new object[]{this.systemInfo.PhysicalMemorySize});
pcd.CountHandle += this.AvaiableCounterHandler;
this.performanceCounters.Add(key, pcd);
return pcd;
}
return this.performanceCounters[key];
case DataType.LogicalDiskLoadPercent:
if (!this.performanceCounters.ContainsKey(key))
{
PerformanceCounterData pcd = new PerformanceCounterData(new PerformanceCounter[] { new PerformanceCounter("LogicalDisk", "Disk Bytes/sec", instanceName) }, type, GetDataType.Percent, instanceName, new object[] { 100 });
pcd.CountHandle += this.CurrentLoadCounterHandler;
this.performanceCounters.Add(key, pcd);
return pcd;
}
return this.performanceCounters[key];
case DataType.LogicalDiskReadLoadPercent:
if (!this.performanceCounters.ContainsKey(key))
{
PerformanceCounterData pcd = new PerformanceCounterData(new PerformanceCounter[] { new PerformanceCounter("LogicalDisk", "Disk Read Bytes/sec", instanceName) }, type, GetDataType.Percent, instanceName, new object[] { 100 });
pcd.CountHandle += this.CurrentLoadCounterHandler;
this.performanceCounters.Add(key, pcd);
return pcd;
}
return this.performanceCounters[key];
case DataType.LogicalDiskWriteLoadPercent:
if (!this.performanceCounters.ContainsKey(key))
{
PerformanceCounterData pcd = new PerformanceCounterData(new PerformanceCounter[] { new PerformanceCounter("LogicalDisk", "Disk Write Bytes/sec", instanceName) }, type, GetDataType.Percent, instanceName, new object[] { 100 });
pcd.CountHandle += this.CurrentLoadCounterHandler;
this.performanceCounters.Add(key, pcd);
return pcd;
}
return this.performanceCounters[key];
case DataType.NetworkInterfaceLoadPercent:
if (!this.performanceCounters.ContainsKey(key))
{
PerformanceCounterData pcd = new PerformanceCounterData(new PerformanceCounter[] { new PerformanceCounter("Network Interface", "Bytes Total/sec", instanceName) }, type, GetDataType.Percent, instanceName, new object[] { 100 });
pcd.CountHandle += this.CurrentLoadCounterHandler;
this.performanceCounters.Add(key, pcd);
return pcd;
}
return this.performanceCounters[key];
case DataType.NetworkInterfaceReceivedLoadPercent:
if (!this.performanceCounters.ContainsKey(key))
{
PerformanceCounterData pcd = new PerformanceCounterData(new PerformanceCounter[] { new PerformanceCounter("Network Interface", "Bytes Received/sec", instanceName) }, type, GetDataType.Percent, instanceName, new object[] { 100 });
pcd.CountHandle += this.CurrentLoadCounterHandler;
this.performanceCounters.Add(key, pcd);
return pcd;
}
return this.performanceCounters[key];
case DataType.NetworkInterfaceSentLoadPercent:
if (!this.performanceCounters.ContainsKey(key))
{
PerformanceCounterData pcd = new PerformanceCounterData(new PerformanceCounter[] { new PerformanceCounter("Network Interface", "Bytes Sent/sec", instanceName) }, type, GetDataType.Percent, instanceName, new object[] { 100 });
pcd.CountHandle += this.CurrentLoadCounterHandler;
this.performanceCounters.Add(key, pcd);
return pcd;
}
return this.performanceCounters[key];
default:
return null;
}
}
示例14: GetWrongPropertyDataTypeException
protected static ArgumentException GetWrongPropertyDataTypeException(string paramName, DataType expectedDataType)
{
return new ArgumentException(String.Concat("The DataType of '", paramName, "' must be DataType.", expectedDataType.ToString()));
}
示例15: search
public static String search(DataType dataType)
{
DataConfiguration dataConfiguration;
if (m_DataConfigurations.TryGetValue(dataType, out dataConfiguration))
{
m_dlgSearch.configure(dataConfiguration.m_table);
m_dlgSearch.ShowDialog();
return m_dlgSearch.getSelectedId();
}
else
{
throw (new Exception("Unable to convert '" + dataType.ToString() + "' into a DataConfiguration.DataType"));
}
}