本文整理匯總了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;
}