|
Are your collections actual .Net classes or are they themselves just lists ? It is not clear the way you have structured your question.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Off the top of my head, you should be able to use the Any clause in place of the inner Where , and you need to apply .ToList() at the end to convert it from a query into a concrete collectino.
|
|
|
|
|
Query methods are only for selecting or creating objects, not modifying them. So you can't pass school objects with the student list modified to only contain students studying IT, unless you create a new School.
I think you want CheckStudents to take the list of schools and the subject:
void CheckStudents(IEnumerable<School> schools, string subject){
foreach(School school in schools){
var students = school.Students.Where(s => s.Study == "IT");
}
}
Or if you want to filter the schools you can do
CheckStudents(School.Where(s => s.Students.Any(s => s.Study == "IT")))
... but you still need to have the students within a school filtered in a separate query.
|
|
|
|
|
hello all,
how to convert HTML file to Excel in C# without using any thirt party tool.
Thanks
|
|
|
|
|
Rename it to .xls, and open it in Excel. Presto! Alternatively, you could use ADO.NET (you can look up the connectionstring here[^]).
Those techniques are limited, in the sense that they work with raw data, and not with the Excel DOM; for that you do need a third-party library, or contact Microsoft and write your own.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy,
I tried with renaming of html file to xls .It did work.But,I got to know that we can convert the Html file to Xml and later that xml file con be converted to .xls
Thanks
|
|
|
|
|
Excel supports multiple formats, and the first thing you need to find out is the lowest version that you need to support. The older versions, like the Excel 95 binary format will require an third-party tool.
For the newer version, I'd recommend the Office OpenXml format; that too, is a complexer format, and you don't want to waste time on reimplementing it yourself. If you only need it as a report, I'd go for Xml, and simply rename it to Xls; that way you wouldn't have access to the advanced functions, just as with ADO.NET.
You'll have to invest some time in looking at the advantages and disadvantages of each of these options
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
how can i create an interface for crystal report at user end.user could be able to move report objects like textobjects from one place to another.pls help me to solve this
|
|
|
|
|
You have already asked this in QA, editing crystal report at user end[^] and received an answer.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Is there not such a control you can host in your app? I know Active Reports did ten years ago, so I expect Crystal does by now.
|
|
|
|
|
Hello
I have question:
- how I can change location my task bar from C# code ?
Default location is in bottom, I need in C# - change position my task bar: left, right, top, bottom.
How I can start ? 
|
|
|
|
|
mt1024 wrote: How I can start
I'd start with a Google [^]search, then I'd read some of the responses and see if they give me any ideas for further research.
After that I would refine my searches, read the articles and create a project based on the samples and replies. If I had a specific problem I would either ask on the forum where the article/reply was posted or ask here.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The 'normal' ways of doing this no longer work since Vista - let's face it, it's not great for a user if a program moves their taskbar!
The only way I know of to do this now is to simulate clicking, dragging and releasing the mouse at the right coordinates.
|
|
|
|
|
For a C# 2008 desktop/console application I want to share a linq to sql (*.dbml file) between 2 different project files in the same solution.
I know that I should probably put the linq to sql (*.dbml file) in its own project file with a class libary?
Since I do not know how to accomplish this goal, I am wondering if you can point me to a reference on how to accomplish this goal?
|
|
|
|
|
|
Your link is good! However, I would like to use linq to sql (*.dbml) files since that is the way I have the code setup currently.
I have told my boss that (linq to sql) or linq to the entity framework is the better way to go since that is the newest technology. (My boss has some java experince.)
Thus can I setup the class library that connects to the database by using linq to sql and/or linq to some other technology? If so, can you tell me and/or point me to a reference that will accomplish this goal?
|
|
|
|
|
If your talking about non .NET technologies, no. But if you want to create a suit of applications based on .NET, then the n-tier dsign is the way to go. Build a data access library (DAL). Create a business layer (BAL) that references the data access library. Then create seperate applications that reference the business library.
You may be able to take your existing code and refactory it out into the different layers and then start building the new applications and share all that common DAL and BAL code. If your forms/pages are making calls directly to the database in your corrent solution: it may be harder.
"You get that on the big jobs."
|
|
|
|
|
Have to insert a large number of columns into a datatable (178 to be precise). Tried DataTable.Add() but its just too slow. Tried DataColumnCollection.AddRange(dataColumn[]) after creating the array of DataColumns - probably Slower!
It seems to check for column existence etc and other voodoo before adding a column. Is there a way of modifying this behavior?
Thanks in advance.
bart
|
|
|
|
|
This begs some questions!
Why are you using a datatable originating in C#?
If you need a datatable why does it not exist in a database?
Is creating the datatable in the database quicker than in C#?
Why can't you use a collection instead of a datatable?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for your reply. This project doesnt involve/require databases of which i am very very familiar with in many languages. It involves Datasets only! At some point i really considered shipping SQLServer just to cut down the time it takes to insert, delete and sort the datatables.
BTW, do you have any ideas on how to fix this?
{like turn of error checking, insert columns then turn it back on}
bart
|
|
|
|
|
Why not use collections, as you have found out datsets have some serious overheads. While I have built up datatable in code before I have never had to deal with that number of columns and that was when I was using winforms.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Bart wrote: Is there a way of modifying this behavior?
Yes[^], but you'd be wanting to use collections as suggested. 178 columns in a datatable indicates a non-normalized table. Either you have a collection that's going to be dumped, or you need a database.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Working with text files (csv).
Let me have a good look at the collections.
The turn off feature is for loading data...
brb
bart
|
|
|
|
|
Non-normalized data. Wouldn't it be a bit more efficient to load it into a Sqlite database and process it further from there? What are you planning to do with the data?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
A lot of in-memory manipulation (which is all OK) then output to a text file of sorts (no problems with that either).
Trying a different approach before I go to collections. Will create a new datatable(dt) with required cols and then blast data into it. Will probably be 100 times faster.
Report back in a few mins. Dont give up on me yet.....
bart
|
|
|
|