本文整理匯總了C#中WebApplication1.List.Distinct方法的典型用法代碼示例。如果您正苦於以下問題:C# List.Distinct方法的具體用法?C# List.Distinct怎麽用?C# List.Distinct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WebApplication1.List
的用法示例。
在下文中一共展示了List.Distinct方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
int sheet_number = Convert.ToInt32(TextBox1.Text);
int column_number = Convert.ToInt32(TextBox2.Text);
string cell_entry = "";
List<string> list_images = new List<string>();
foreach (Row row in (((Workbook.Worksheets(excel_path)).ElementAtOrDefault(sheet_number-1)).Rows))
{
if (row.Cells.ElementAtOrDefault(column_number-1) != null)
{
cell_entry = (row.Cells.ElementAtOrDefault(column_number-1)).Text;
list_images.Add(cell_entry);
}
}
List<string> distinct_images = list_images.Distinct().ToList();
foreach (var images in distinct_images)
{
System.Drawing.Image image = DownloadImageFromUrl("https://media.loylty.com/Gallery/" + images + ".jpg");
if (image != null)
{
string rootPath = ConfigurationManager.AppSettings["FolderPath1"];
string fileName1 = Server.MapPath(rootPath + images + ".jpg");
image.Save(fileName1);
}
}
}