I agree with you that it is because of string interning. However, in this case, there is no way to distinguish if the two objects are different or not. So for the string class, the Equals and ReferenceEquals have no differentiation -- this is little bit frustrating!!
You can clone a string to get a different instance with the same value.
Or if you use Substring, you will also get a different instance of the same string:
object.ReferenceEquals("Hello", "Hello World".Substring(0,5)) will return false!
Why is this frustrating? The runtime creates interned string instances when the method is JITted. This is much faster than creating the string instance everytime the method in run. If you want a new string instance every time, well, then you still can use Clone().
I'm written a crazy simple service in C# and a simple class library that exposes 1 class. We're talking "hello world" simple here.
Here's the wierdness.
I have a reference to the class library from the service, when I attempt to start the service, I get an event log entry saying that it can't find the class library.
Event log record-->
Service cannot be started. System.IO.FileNotFoundException: Could not load file or assembly 'SampleClass, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'SampleClass, Version=18.104.22.168, Culture=neutral, PublicKeyToken=null'
at RemotingTest.TestService.OnStart(String args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
What I've tried.
Create a console app using the same code -> Works
Remove the calls to the class library and start the service -> Works
uninstall the service/reinstall the service and start the service -> Fails.
Copy the class library dll to the windows system32 directory -> Fails.
Any ideas? I'm sure that it is something really stupid, but I can't think of it.
I forgot all about Filemon...it showed me the error in my ways...., the service was looking for the class library in the obj\debug\ folder instead of the bin\debug folder which is where I put the dll. I still don't know why it didn't work when I put it in the system32 folder.
but at least I'm up and running....for now. <hehe>
The problem is that node grandpa/father/son is not executed! It's passed to XSL file
but XslTransform classes transsform method does not fetch it's value from xml file.
It only shows the key value in console. Node grandpa/father/son has value in it's
So, am I missing something or is there a bug in XsltArgumentList and it's transformation.
I have a link on my webpage, when clicked upon it takes the user to a page where the website's home page is added to the favourites. Can someone please tell me where to go and look for this on MSDN. I would like to do it through C#. And also, maybe create a directory in My Favourites, and save the link in this directory.
I've got a problem I can't solve, maybe I did the wrong searches on google for that !
I have some short and int values I want to put one behind the other in an existing byte array. In C++ i would have done a memcopy for each value passing the pointer to the byte array position I needed. Then, for reading, I would have done something like int i = (int)b;
Now I have to do that in C#, and if possible using a way that would be as fast as the C++ way ... How can I do that ?
I wish to create a mutiview control and then want to dynamically add view cotrols to it while the webpage is displayed. The problem is that when I do this and run my webform, I get the following error:
ActiveViewIndex is being set to '0'. It must be smaller than the current number of View controls '0'. For dynamically added views, make sure they are added before or in Page_PreInit event.
I did create the view controls in the Page_Load() function and then added them to the Views property of the multiview Cotrol object..
When l change the value of the combo box, as soon as the combo box loses focus the value will change to the value it was before. The new value does not remain. Has this got something to do with the edit options of the datagrid. I am not sure.
The only way l have solved this problem is to save the new value to the database, and then fill the datagrid from database again with the new. This has to be done everytime the user changes the combo box value.
The way l would like this to work is for the user to change the values in the combo boxes, and have the value remain. When they have finished, they can save everything to the database.
I hope you can help me with this project again. I have the code below that inserts the combo box into the datagrid.
please help i have a windows application connected to a local MSSQL server and i want to make the application to be used over lan, what sholud i change only the connection string so that it will work over lan and for more than one user.
please help and thanks for your time and consederation
Firstly, are you using Windows Security (trusted connection) or SQL Server security (you have a separate username and password for SQL Server)?
Does everyone who's going to use your application access SQL Server the same way? Do all your users have access to SQL Server?
These are the things that you need to determine before going forwards. If everyone in your workplace has a trusted connection to SQL Server and access to the DB, then you don't need to provide username and password information in your connection string. Otherwise, you'll have to get a username and password from each user (to include in the connection string) before they can get access to the SQL Server DB.
I hope this helps.
Last Visit: 31-Dec-99 19:00 Last Update: 27-Nov-22 9:08