PDA

View Full Version : تبدیل این کد و توضیح



unrealword
چهارشنبه 31 اردیبهشت 1393, 22:06 عصر
LinkVal = GetPost(postID, .Username, .Password).custom_fields.Where(Function(t As CustomField)
Return t.key = .CustomField
End Function)(0).value.Trim()

من این کد رو از وی بی به سی شارپ تبدیل می کنم
خطا می ده
می شه کمک کنید دستورش توضیح بدید ممنون می شم

aghayex
چهارشنبه 31 اردیبهشت 1393, 23:28 عصر
به نظر من این کد هیچ معنی نداره .
کد وی بی رو بذار

unrealword
چهارشنبه 31 اردیبهشت 1393, 23:33 عصر
این دستور فیلتر کردن ارایه بر اساس مقدار کلید دستور همین بود
کسی می تونه این دستور رو اصلاح کنه

unrealword
چهارشنبه 31 اردیبهشت 1393, 23:54 عصر
Error 2 Cannot apply indexing with [] to an expression of type 'System.Collections.Generic.IEnumerable<JoeBlogs.CustomField>' C:\Users\yaali\Desktop\Application Project\DownloadPostWordpress\DownloadPostWordpres s\DownloadPostWordpress\wordpress.cs 83 15 DownloadPostWordpress


اینم کد که من نوشتم تبدیل شده





var filds= cf.Where(t =>
{
return t.Key == "download_links";
})[0].value;

khokhan
پنج شنبه 01 خرداد 1393, 09:34 صبح
Error 2 Cannot apply indexing with [] to an expression of type 'System.Collections.Generic.IEnumerable<JoeBlogs.CustomField>' C:\Users\yaali\Desktop\Application Project\DownloadPostWordpress\DownloadPostWordpres s\DownloadPostWordpress\wordpress.cs 83 15 DownloadPostWordpress


اینم کد که من نوشتم تبدیل شده





var filds= cf.Where(t =>
{
return t.Key == "download_links";
})[0].value;


dic = dic.Where(p => p.Key == 1)
.ToDictionary(p => p.Key, p => p.Value);