本文整理汇总了C#中System.Double.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# Double.Cast方法的具体用法?C# Double.Cast怎么用?C# Double.Cast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Double
的用法示例。
在下文中一共展示了Double.Cast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSummonerNames
/// 11.)
public async Task<String[]> GetSummonerNames(Double[] summonerIds)
{
int Id = Invoke("summonerService", "getSummonerNames", new object[] { summonerIds.Cast<object>().ToArray() });
while (!results.ContainsKey(Id))
await Task.Delay(10);
String[] result = new String[results[Id].GetTO("data").GetArray("body").Length];
for (int i = 0; i < results[Id].GetTO("data").GetArray("body").Length; i++)
{
result[i] = (String)results[Id].GetTO("data").GetArray("body")[i];
}
results.Remove(Id);
return result;
}
示例2: GetSummonerIcons
/// 16.)
public async Task<String> GetSummonerIcons(Double[] summonerIds)
{
int Id = Invoke("summonerService", "getSummonerIcons", new object[] { summonerIds.Cast<object>().ToArray() });
while (!results.ContainsKey(Id))
await Task.Delay(10);
String result = (String)results[Id].GetTO("data")["body"];
results.Remove(Id);
return result;
}
示例3: Matrix2ImageMax
/// <summary>
/// Converts array elements into pixel values (values normalized using maximum element)
/// </summary>
/// <param name="Matrix">Array</param>
/// <returns>Greyscale image</returns>
public Bitmap Matrix2ImageMax(Double[,] Matrix)
{
Bitmap img = new Bitmap(Matrix.GetLength(0), Matrix.GetLength(1));
Double max = Matrix.Cast<Double>().Max();
for (int i = 0; i < Matrix.GetLength(0); i++)
{
for (int j = 0; j < Matrix.GetLength(1); j++)
{
//Double a = 255 / Math.Log10(1 + max);
//int value = (int)(a * Math.Log10(1 + Matrix[i, j]));
int value = (int)(Matrix[i, j] / max);
if (value > 255) value = 255;
Color p = Color.FromArgb(255, value, value, value);
img.SetPixel(i, j, p);
}
}
return img;
}