|
J4amieC wrote: So your only option is MyArrayHelper.Find
Yes. I used that way in my project[^] now.. that's big problem in porting WPF to SL. I need to change all Array.Find to ArrayHelper.Array.. The same goes for Enum.GetValue too.. I had to use EnumHelper.GetValue. or I have to use Linq for that..
|
|
|
|
|
Michael Sync wrote: I need to change all Array.Find to ArrayHelper.Array..
Make a wrapper method, and use that all over, then only 1 place to call the helper.
|
|
|
|
|
leppie wrote: Make a wrapper method, and use that all over, then only 1 place to call the helper.
You mean like that.
public static class Array{
public static ... Find(..){
}
public static ... Remove(...){
System.Array.Remove(....);
}
}
Is this like that? but I think the name will be conflict. (My Helper.Array and System.Array) And I can't remove "using System;" since there are a lot of other references..
|
|
|
|
|
Put your array class in the root namespace of your project. That way, it will be used as the default instead by VS. If at anytime you need the built in class just specify System.Array
Dave
|
|
|
|
|
Thanks. That means I dont need to change Array.Find to ArrayHelper.Find. But I will need to change Array.Remove to System.Array.Remove?
Another thing: I think the name will be conflict.
|
|
|
|
|
Michael Sync wrote: But I will need to change Array.Remove to System.Array.Remove
No. For any methods that you need to keep that exist in System.Array - simply create a method in your class with the same return type, name and signature. Then in your method return the System.Array's method result passing the parameters to it.
Michael Sync wrote: Another thing: I think the name will be conflict.
No, the IDE and compiler will assume yournamespace.class if there is also a System.class with the same class name.
Dave
|
|
|
|
|
Thanks, Dave. I will try. But Scott's suggestion is also nice one. I will keep the suggestions from both of you and I will mentioned about that to my manager..
|
|
|
|
|
I'd highly reccommend against doing that. It can and most likely will lead to a lot of maintenance headaches later. It will also make it harder for new developers to get up to speed on the codebase since there is now a "new" Array class that isn't the standard one that everyone is familiar with.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Even though I suggested it, I agree. Personally I would carefully rename all the 'Array' code to my helper class but the OP didn't want to do that.
I've only done it the other way once and I made sure I implemented EVERY method/property/interface and all their overloads from the original class to avoid problems. It's been OK so far, but it was a headache creating the class in the first place!
Dave
|
|
|
|
|
Thanks, Scott.
It's true that it will lead a lot of maintenance headaches but the problem is that we already have a lot of classes written for WPF project. I'm trying to port them to Silverlight-compatible project. What I was thinking is that if we can use the same way that we used to use for WPF then new developer won't need to remember that we have to use this (e.g ArrayHelper.Find) in Silverlight and we have to use that (ie. Array.Find) in WPF. All he need to do is that just use Array.Find no matter whether he is in Silverlight or WPF..
|
|
|
|
|
I understand the problem you are looking at. It's a trade off as either way you are going to end up with possible maintenance issues later.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Technically, extension methods require an instance of the data type being extended as the first parameter so you can't create a "true" static method on the actual type. You'll need to continue using a static helper class/method or create an extension method and call it from the instance of the array you want to search for the value.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Hi there.
I sometimes see Annotations method in XML LINQ.
Can you tell me what this is and what we can do by it ?
|
|
|
|
|
Hi,
How can i edit or call single cells in tableLayoutPanel like in Ms Excell?
(or other kind of panel)
Thanks!!!
|
|
|
|
|
You are using the wrong control. Use DataGridView.
|
|
|
|
|
I use the datagrid to get data from the sql server.
I will trie to use the datagrid for other purposes.
Thanks
|
|
|
|
|
You can edit cell in DataGridView. But you cannot edit data in TableLayoutPanel. Because that are only panels.
|
|
|
|
|
Hi all,
I have a project i'm currently working on and would desire to send and receive sms with a SQL Server 2000 back end data store. My application will be able to query the database, return the results and send it through the Ozeking sms gateway API.
I need to know if this is possible with SQL Server 2000 and the direction to take please.
Thanks in advance.
Obinna from Nigeria.
//obinnaaj Eof
|
|
|
|
|
hi obinna,
I think you are in wrong forum,
but all you mention above is possible to do, as i know if you have text from or to your sms gateway, you can store them in many ways including sql server 2000.
hope it help
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
Hi.
I want to convert a XML file to the String[].
I used this code :
String[] xml = File.ReadAllLines("bookmark.xml", Encoding.UTF8)
there are some characters (like these : 
 
) that didn't convert.
How can I convert these characters to the original characters.
|
|
|
|
|
Don't. Use an XmlDocument; it makes life much earier.
|
|
|
|
|
Thank you.
But I force using above way
|
|
|
|
|
|
|
Before you say it - I haven't voted your answer down!
PIEBALDconsult wrote: Use an XmlDocument
I've seen you use that response before. You really should have a look at System.Xml.Linq.XDocument .
Dave
|
|
|
|