Click here to Skip to main content
15,077,641 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I used a query like the following code in a function:
C#
var WellObjCode_WellNo = from c in DC.WellGeneralInfos where c.FieldObjCode == _fieldObjectCode select new { WellObjectcode = c.WellObjCode, WellNO = c.WellName };
            return WellObjCode_WellNo;

I want to return WellObjCode_WellNo
which is a table with 2 collumns. what should I write in a function in order to determine this returning type. I think that it should be sth like
Iqueryable<"A_Type">
, but what should I put in place of "A_Type" ?
Thanks a lot in advance!
Posted

1 solution

Hi,
An anonymous type is no different from any other reference type, except that it cannot be cast to any type except for object.An anonymous type has method scope. For more details see http://msdn.microsoft.com/en-us/library/bb397696.aspx[^]
It is better to use a strongly typed object if you need to pass the result from the method.Then you can use IEnumerable <<UrType>> as return type.
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900