473,409 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

The least-cost way to return a one-row IEnumerable object?

The function must return a IEnumerable object with one row (any data). I have
the following code. Any less cost way?

IEnumerable^ udf()
{
DataTable dt;
dt.Columns->Add("Test");
dt.Rows->Add(1);
return dt.Rows;
}
Apr 19 '06 #1
3 1364
How about

IEnumerable^ udf()
{
return gcnew cli::array<Object^> { yourOneAndOnlyElement };
}
"nick" <ni**@discussions.microsoft.com> wrote in message
news:EE**********************************@microsof t.com...
The function must return a IEnumerable object with one row (any data). I
have
the following code. Any less cost way?

IEnumerable^ udf()
{
DataTable dt;
dt.Columns->Add("Test");
dt.Rows->Add(1);
return dt.Rows;
}

Apr 19 '06 #2
I am thinking some constant object so there is no runtime gcnew....?

"Marcus Heege" wrote:
How about

IEnumerable^ udf()
{
return gcnew cli::array<Object^> { yourOneAndOnlyElement };
}
"nick" <ni**@discussions.microsoft.com> wrote in message
news:EE**********************************@microsof t.com...
The function must return a IEnumerable object with one row (any data). I
have
the following code. Any less cost way?

IEnumerable^ udf()
{
DataTable dt;
dt.Columns->Add("Test");
dt.Rows->Add(1);
return dt.Rows;
}


Apr 19 '06 #3

"nick" <ni**@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
I am thinking some constant object so there is no runtime gcnew....?

"Marcus Heege" wrote:
How about

IEnumerable^ udf()
{
return gcnew cli::array<Object^> { yourOneAndOnlyElement };
}


IEnumerable^ is a tracking handle. Tracking handles can only refer to
objects on the garbage collected heap. Objects on the garbage collected heap
are created with gcnew (or boxing, which is not relevant here). So the
answer to your question is: No, there is no way to avoid creating an object
on the gc heap if you want to return IEnumerable^.

Marcus
Apr 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: venkat | last post by:
Hi, I want to solve linear least sqaure problem( min||c-Ax||2 subject to Bx=d ). How do I do it in python. lapack has a routine for doing this (DGGLSE). Can I access this from python? TIA,...
1
by: Jim Mellish | last post by:
I am trying to put together a schema with some validation on addresses. Three of the address fields are Flat, HouseName and HouseNumber. I have to ensure that at least two of the three or all...
20
by: GS | last post by:
The stdint.h header definition mentions five integer categories, 1) exact width, eg., int32_t 2) at least as wide as, eg., int_least32_t 3) as fast as possible but at least as wide as, eg.,...
8
by: Mike Nolan | last post by:
As far as I can tell, Postgres has no equivalent to greatest and least functions in Oracle. Yes, you can do the same thing with a case statement, but at the expense of writing MUCH longer SQL...
3
by: blurryhaddad | last post by:
hi all.. i dont understand this sql statement(decode and least) please help me.. sum(decode(f.code_category,'3',...
1
by: blurryhaddad | last post by:
hi all.. i dont understand this sql statement(decode and least) please help me.. sum(decode(f.code_category,'3', nvl(decode(d.flag_result,null,decode(least(b.date,...
2
by: Shawn Minisall | last post by:
I just wrote a program to let the user input a series of whole numbers and tell them which is least and which is greatest based off of a menu. However, the menu isn't kicking in after they pick a...
2
by: laredotornado | last post by:
Hi, Given select menus named birthMonth, birthDay, and birthYear, how do I check if the user has selected values such that he/she is at least 18 years old? Thanks, - Dave
4
by: Evelien | last post by:
Dear python-users, I am trying to do a non-linear least squares fitting. Maybe trying is not the best word, as I already succeeded in that. At the moment I am using leastSquaresFit from...
0
by: benjon | last post by:
i have a table as follows: create table "ITMS_JobCardActorStatusHistory" ( "jobCardNo" int identity not null, "issueID" int not null, "assignedTo" char(5) not null, /*this is emp id*/...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.