|
|
unfortunately not, nice article though.
Thanks for the reply.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
hi to all
i would like to ask, is it possible that if i create a system and i want to generate the display items into excel file or txt file is it possible??
Warm Regards
Veon
|
|
|
|
|
Yes.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
LOL, i was going to answer the exact same way but i decided against it.
LOL though
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
|
Adam R Harris wrote: Well anything IS possible
No CG got to say no to the open folder detection question
Just that this question is not totally invalid.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Have 5 - some of the questions here seem to be just plain silly, and then someone comes up with an answer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi all
how can i find specific values in the List<> class?
there is "
public T Find (Predicate <T> match)" , FindAll and findindex class functions ... but there all using the
Predicate Delegate function , the search value is fixed in the Delegated function (as seen in the example in MSDN).
is there way to search the list<> in Generic function specific values without using for each loop or any other loops?
Thanks
|
|
|
|
|
Think about this question for a moment.
Is there a way to search through the entire collection, without looking at each item ? The answer is yes, but only if you sort your collection. Then you can make each search step divide the existing collection in two. Otherwise, it's obviously not possible, that kind of goes without saying.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
pascal.schwartz wrote: the search value is fixed in the Delegated function
What do you mean by that?
|
|
|
|
|
From the MSDN the search value "saurus" is fixed, the EndsWithSaurus is the Predicate Delegated function
used
dinosaurs.Find(EndsWithSaurus));
dinosaurs is List of string object
private static bool EndsWithSaurus(String s)
{
if ((s.Length > 5) &&
(s.Substring(s.Length - 6).ToLower() == "saurus"))
{
return true;
}
else
{
return false;
}
}
|
|
|
|
|
Hi,
I understand your pain. Wouldn't it be nice to be able to write:
dinosaurs.Find(EndsWith("saurus"));
A little bit of code is required to get a variable into the predicate.
public class StringPredicate {
String stringToMatch;
public StringPredicate(String toMatch) {
this.stringToMatch = toMatch;
}
public Boolean EndsWith(String s) {
if ((s.Length > 5) && (s.Substring(s.Length - 6).ToLower() == this.stringToMatch)) {
return true;
} else {
return false;
}
}
}
Now you may call the List.Find method like this.
dinosaurs.Find(new StringPredicate("saurus").EndsWith);
Easy when you know how!
Alan.
[edit] Version2, a slight rejig of the code
public class StringPredicate2 {
String stringToMatch;
private StringPredicate2(String toMatch) {
this.stringToMatch = toMatch;
}
private Boolean Match(String s) {
if ((s.Length > 5) && (s.Substring(s.Length - 6).ToLower() == this.stringToMatch)) {
return true;
} else {
return false;
}
}
public static Predicate<String> EndsWith(String searchTerm) {
return new StringPredicate2(searchTerm).Match;
}
}
Now you may call using a more natural form:
dinosaurs.Find(StringPredicate2.EndsWith("saurus"));
modified on Monday, August 3, 2009 9:34 AM
|
|
|
|
|
So you want a generic find method which can find any string in your list, right? Try this,
string Find(List<string> list, string itemToFind)
{
return list.Find(item => item == itemToFind);
} Lambada expressions makes it very easy.
|
|
|
|
|
If it's a list, you need to search it. (And there could be duplicates.)
If you convert it to a HashSet you don't.
|
|
|
|
|
how can i program a microcontroller in c#??
i want asource code for the main programming
|
|
|
|
|
lollipop1312 wrote: how can i program a microcontroller in c#??
i want asource code for the main programming
Well, I doubt you can, but I'd try to write you one for a standard contract rate ( say, $120 an hour ). You didn't expect someone to write it for free, did you ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
thanx
but dont u think thats too expensive
|
|
|
|
|
$120 an hour for a custom programming job on custom hardware?? That's actually pretty cheap...
|
|
|
|
|
To add to what Christian said, see this thread from last week: Can-I-write-programs-in-C-sharp-to-Micro-Controllers[^]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
That is a tough job. You need:
- a C# compiler or cross-compiler (the .NET one running on a PC would be fine),
- a virtual machine running on your target machine;
- as much of the .NET classes as your VM and your app are going to use.
Creating it from scratch is doable in theory, as it is similar to programming a micro-controller in Java, however the effort required exceeds several man-years of expert development. You feeling the need to ask (and the content of your subject line) disqualifies you for the job.
Starting from an existing system such as Mono, I can't tell as I haven't looked into it in any detail. I trust it would still be a major job.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Basicly what I am tring to do is change a files properties to super hidden.
(or system hidden) like the protected operating files. read about a way to do this manually
with the cmd.exe(comand line). one could probably build a batch file to do this. But the clean
way would be to do it with in the C# application that creates the file in the first place.
But Im not sure how to go about doing it. the "File.Atributes" only has the general type properties
.It has "hidden" and also "System". But what I need to do is tuck away a file that my program can access And be sure that it wont get deleted or changed.
Any Help would be greatly Appriceated.
Regards;
Rick
|
|
|
|
|
FileInfo.Attributes is the property you are interested in!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
No matter what you do some users will find a file on my system if I really need to, if it is malicious then tough, if your are looking at a licencing type system then there are better ways, mind you they do cost money. Or you can use encryption and leave it in the open.
Never underestimate the power of human stupidity
RAH
|
|
|
|