|
Hello,
I am developing an application using C# windows application in .NET framework 2.0 all is fine on the local machine I make the service then I call it in the app and it runs fine.
But when I put the app on the main server where the same web service is runing live now here how can I set the settings in my app that it should look for the service on the main server not localhost.
In .NET 1.1 it was simple that we add the service and made it dynamic from the properties window and then change the service address in the app.config file but this is not getting done in .NET 2.0
please help
thanks
regards,
Farrukh
Regards,
Farrukh Malik
+92-300-2564099
|
|
|
|
|
Is there any data structure avilable out of the box in Framework 3.5, kind of reverse lookup dictionary.
Dictionary< key1, key2 > d = new Dictionary< key1, key2>();
Key2 k2 = d[key1];
Key1 k1 = d[key2];
Thanks
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
There is no reverse lookup in a dictionary because one value can lead to multiple keys, but not the other way round.
To get a list of keys that result in a specific value you can use this:
var keys = from key in dic.Keys
where dic[key] == somevalue
select key;
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks,
but in my case both are unique.
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
vytheese wrote: but in my case both are unique.
In this case I would derive a class from IDictionary that will internally hold two dictionaries, one for key->value and one for value->key. Something like:
public class TwoWayDictionary<K, V> : IDictionary<K, V>
Override the methods like Add, Contains etc to allow adding, removing and searching by key and value in both of the dictionaries.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The wrapper will ease from access point of view but Again I will end up in performance issue while searching from value point.
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
Why? You will be looking up the value as a key in your second dictionary.
|
|
|
|
|
Good, Sorry I failed to notice that. But in any case its only a wrapper for me.
What I am looking for is single dictionary with key, values both indexed or hashed.
since in my scenario the collection I am expecting is huge and time for process is having little window. so I want to get the feasible data structure that will helps me in both (space/time).
But with the time contstraint for my execution I have to trade between space vs time for a intial release.
Grazie.
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
vytheese wrote: What I am looking for is single dictionary with key, values both indexed or hashed.
That exactly what a wrapper class with 2 dictionaries will do...
|
|
|
|
|
Yeah, I just use two Dictionaries.
|
|
|
|
|
hi,
can anybody give me a tip (may be a little tip) to create word equations using .tex files automatically.
thanks in advance.
|
|
|
|
|
My Boss give me a project and say read it Compleatly in this Project there is Class Called CaspolSecurityPolicyCreator.cs i serach it on net but did not Found any help can any body tell me why we use it. The Project is Of add-on on Outlook
wasim khan
|
|
|
|
|
Well, I suspect if you didn't find it on the net it must be something written by or bought by your company. try asking some of your colleagues.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Although I've been programming for years but I need somebody to explicitly assure me that I am correct as I am developing a critical piece of software. The problem is that when you need a very basic rule you cannot find it on search engines
when I define a variable of bool like this:
bool b;
is it automatically initialized to false?
what about int? is it automatically initialized to zero?
Thanks all
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
i think that u have a lot of time thats why u write this message please check it by ur self creating one boool variable and int.
wasim khan
|
|
|
|
|
Well, if I use your genius method then I'll have a 50% possibility of getting a wrong answer, plus consider that I am writing a critical piece of code, not a game - Thanks anyway
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
Mohammad A Gdeisat wrote: I am writing a critical piece of code, not a game
Tell that to the lead designer of an upcoming game title.
|
|
|
|
|
|
Mohammad A Gdeisat wrote: Well, if I use your genius method then I'll have a 50% possibility of getting a wrong answer
How do you come to this conclusion?
if you wrote the following code it would 100% give you the answer to your question:
bool testBool;
Console.WriteLine(testBool);
int testInt;
Console.WriteLine(testInt);
|
|
|
|
|
1st, I was talking about bool which was the main concern.
2nd, it is 100% for u becoz u already know it.
Anyway, let's end here.
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
Yes bool defaults to false and int defaults to 0 if it's a class member variable. I think FxCop/VS code analysis gives warnings if you do try to initialise it, and suggests that it's not necessary.
If it's a private local variable, the compiler won't yet you use it without explicitly initialising it to something. You'll get a "Use of anassigned local variable 'x' error.
Simon
|
|
|
|
|
Thanks for the detailed answer mate, I bet most of us don't know the details
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
bool: false
int: 0
You can find more information in the C# language specification[^], section 5.2 Default values and especially section 4.1.2 Default constructors:
For all simple-types, the default value is the value produced by a bit pattern of all zeros:
For sbyte, byte, short, ushort, int, uint, long, and ulong, the default value is 0.
For char, the default value is '\x0000'.
For float, the default value is 0.0f.
For double, the default value is 0.0d.
For decimal, the default value is 0.0m.
For bool, the default value is false.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank you mate
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
Never assume that a variable is automatically initialized. If you want it set to false, then set the damn thing to false.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|