English 中文(简体)
如何在没有机会接触匿名类型?
原标题:How can i access anonymous types without FOREACHLOOP?

如何测试所有数据。 i 想要获得检测。 库存量和试验。 条码

请不设员额:

foreach (var person in  myQuery)

    {

        Console.WriteLine(person);

    }

 var test =  (from s in stock.StockMaterials
                                              where (s.date<= DateTime.Now &&
                                              s.date.ToString() != "01/01/1900 00:00") &&
                                              s.id == ItemID &&
                                              s.chkdate == true
                                              select new { stockdescid= s.stockdescid,barcode=s.barcode});
                        if (ID.First() == ItemID)
                            ReturnMsg = "E1: Please check the expiry date : "+test.First().barcode.ToString();

问题回答

匿名类型只能从生成的方法中获取。

你的话

"i want to access test.stockdescid and test.barcode"

但是,“测试”是一种收集,你想要获得的特性是收集的物品,而不是收集本身。

你们没有试验。 条码,而是测试。 第一(a)段。 条码等等。

尽管如此,我不明白你需要做什么。 您能否更清楚了解您的目标?

你们的意思是“检验所有数据”?

页: 1

test.ToList(>)。 ForEach(i => i.DoSomething());

如果能帮助?





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签