|
bneacetp wrote:
' Accessing the first item in the ArrayList.
testArray.Item(0).Name = "New Name"
I figured it out. It compiles and runs well. Intellisense just doesn't show the members of the class.
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
Alternatively:
CType(testArray.Item(0), MyObject).Name It's a good idea to cast if you're performing a lot of operations on the same object, because there's overhead involved in System.Object 's late binding. Prefer to early-bind if you can.
|
|
|
|
|
Thanks for the information.
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
What are the prospects for a low pause-time garbage collector being added to .NET?
(I have a server that is written in .NET, and low latency is important for this server. The server can tolerate many garbage collections, but each garbage collection must be quick. Latencies as long as about 1/3 of a second would be OK; longer is problematic. A garbage collector with pause times of less than .1 second would be great.)
|
|
|
|
|
I am using Windows Server 2003. I installed VC#.NET Enterprise Edition like this:
1. Insert disk-5 to update Windows Component;
2. Insert disk-6 to install VC#.NET;
3. Insert disk-2, disk-3, and disk-4 to install MSDN;
4. Install .NET Framework 1.1 SDK, MSDE, MDAC 2.8 with downloaded packets.
Now I get a problem that the version of .NET Framework displayed in VC# help is not 1.1 but 1.0.3705. And two shortcuts of both ".NET Framework Configuration" and ".NET Framework Wizard" are added into the "Administration Tools" menu. But the same shortcuts as them are added when the Windows Server 2003 installation finished. Then I run the ".NET Framework Configuration", the version of .NET Framework returned is still 1.0.3705.
So I download the packet of .NET Framework 1.1 and install it. But the system show a message that the .NET Framework is installed with installation of operation system.
Later, I uninstalled the .NET Framework 1.1 SDK and VC#.NET, then the two shortcuts is removed too. But the version of .NET Framework is still 1.0.3705.
How can I do? I need the support from .NET Framework 1.1 to develop an application about IP Multicast.
I enjoy programming...
|
|
|
|
|
I have a sub in my VB.Net that is loading a plugin into my Host Application.
I have a method in the system that allows a specific plugin to be unloaded. But I cannot get the assembly to allow me to delete/replace the DLL in the system. I've extracted this out to as simple as I can.
Am I missing something in this code that would allow me to do it.
<br />
Imports System.Reflection<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
Dim objDLL As [Assembly]<br />
objDLL = [Assembly].LoadFrom("Z:\broker\plugins\EODStoretoXML.dll")<br />
objDLL = Nothing<br />
System.GC.Collect()<br />
System.GC.WaitForPendingFinalizers()<br />
System.GC.Collect()<br />
end Sub<br />
|
|
|
|
|
If you need unload assembly, load it in an another domain and then unload domain.
No way for unloading only assembly
P.S. sorry for the my dirty English
|
|
|
|
|
Did anybody implement the IEnumUnknown interface in .NET? I found the Next() method is difficult to implement.
|
|
|
|
|
I would like to change the font style of the text progerty of a TabPage control under certain conditions. can anyone help me with the code?
Thanks!
|
|
|
|
|
What is stopping someone from writing a tool that would convert IL to x86 assembly? Do certain IL instructions not compile to assembly properly?
Please note, I am aware of ngen. While it does compile to a native image, it still requires the .Net framework (it uses mscorlib, CAS, GC, etc.). I'm thinking further than that; compiling IL to pure assembly, no CAS, garbage collection, or any other .Net service required to run the application.
My thought is, compiling a C# app to IL, then to assembly would be ideal for standalone, fully trusted apps that don't require CAS or garbage collection. Obviously, there'd have to be some post-build code creation that will clean up objects (the coder could just use some extern statements that would be replaced upon post-build with object disposal).
What are the issues one would run into? Am I going down a dead end road here?
The graveyards are filled with indispensible men.
|
|
|
|
|
Salamander Protector allow you to do this, but you still need the framework.
What stops you? The whole framework may needed to be called from your code.
As an alternative approach, I would suggest you to make a translator from C# to C++. The generated C++ code would then use some free garbage collection library (there are good ones out there for C++).
Then, you would run your translator on the entire free .NET Framework from Mono and build a static library to link with your application.
Seems feasible (forgeting some .NET niceties, like reflection), but a damn huge work.
This has the side-effect to make your application portable to environments that don't have a .NET framework yet, but have a modern C++ compiler.
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
|
Yes I figured I could compile the .Net library (either Rotor or Mono) into a static library and use that from applications as a portable dll.
Of course, compiling the whole FCL would probably introduce a huge dll requirement, almost as large as .Net itself, thereby nullifying one of the purposes of this whole idea.
The other option would be interesting - translate C# statement to equivalent assembly or C++ statements (ie Console.Write would become printf). This way, you could write a C# app as usual, compile, and it would run anywhere a C++ Windows app would run. Intriguing.
Well, it's an interesting thought at least. Thanks for the information, Daniel.
The graveyards are filled with indispensible men.
|
|
|
|
|
Judah H. wrote:
Yes I figured I could compile the .Net library (either Rotor or Mono) into a static library and use that from applications as a portable dll.
Of course, compiling the whole FCL would probably introduce a huge dll requirement, almost as large as .Net itself, thereby nullifying one of the purposes of this whole idea.
You misunderstood me: when I said 'a static library', I meant a .lib, and the linker would remove (most) unused code from the final .exe, thus generating, for small applications, small executables. I agree that for big applications it potentially will have the size of the application + the size of the framework.
A DLL is a dinamic library, and will be linked at runtime, and so needs to have the whole framework.
Judah H. wrote:
The other option would be interesting - translate C# statement to equivalent assembly or C++ statements (ie Console.Write would become printf). This way, you could write a C# app as usual, compile, and it would run anywhere a C++ Windows app would run. Intriguing.
This is why I mentioned building a library with the framework. Linking a .lib from C++ is a breeze. And, by running your own conversor on the .NET framework, you'll have the whole framework available (well, most of it). This has the same end effect of converting from C# to equivalent C++.
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
|
Hi,
what is the defference between Application domain and a process in .NET ?
|
|
|
|
|
An application domain is a managed application boundary in .NET. You can only cause data to cross domain boundaries using some communication mechanism - you cannot directly call into another application domain (IIRC).
Many application domains can be hosted within a single process. They share the same user-mode address space, which reduces some of the load for the operating system. Different domains in the same process can have their own configurations. ASP.NET takes advantage of this, hosting every site within its own AppDomain, all within the same worker process (aspnet_wp.exe on Windows 2000 and Windows XP; w3wp.exe on Windows Server 2003).
|
|
|
|
|
Thank you for this reply
|
|
|
|
|
Hello,
I'm working on a project where we need to keep track of user's action. We're developing our project in .NET and Windows environment. User's action here means everything that user did. For example, user creates/saves/opens a document or a webpage, sends an email to a recipient, user changes the focus window (by clicking on another window), etc.
We're using automation to trap these events of MS Office and IE. We query for the top most window every second to see if user changed the focus window or not. Other than those applications, we haven't yet figured out a way to do them.
However, the events of MS Office and IE are not very sufficient. For example, Word/Excel/PP object does not provide SaveAs event. Detecting the change in focus is unstable.
I'm just wondering if there is generic way to capture events for all of Windows application. Is there anyway to screen out the underlying messages of the application and then figure out what happened?
Thanks,
|
|
|
|
|
This question is directed towards MSMQ in .NET (System.Messaging.MessageQueue, etc), but is relevant to messaging in general.
Suppose I have a lot of messages coming through some queue (~1000 msgs/sec),
and some function ProcessMessage(Message msg) that I want to invoke to process each message.
There are two ways to read these messages asynchronously (MSMQ/.NET):
1. Begin a thread (or Timer thread) that periodically polls the queue (MessageQueue.Receive()), retrieves a new message, calls ProcessMessage().
2. Call the asynchronous MessageQueue.BeginReceive() to which you pass your callback function (as delegate). Then when a new message comes, the MessageQueue will automatically call your callback function.
The difference in performance is unclear to me. In the second case, it seem you have to do less work, since you get notified automatically when a message arrives instead of having to write a thread that checks this; however, there is more flexibility in the first approach, because you control exactly how the check for new messages is performed, how often, etc. But I am really only interested in performance, and though I am going to write some simple examples to test this, I am not sure that they will be representative of what happens under a real load.
Does anybody have thoughts on this? Thanks!
-Vlad
|
|
|
|
|
I am building a .NET compiler so I want some info on MSIL.Can anyone help.
|
|
|
|
|
|
Yesterday I tried to pass a TransportObject to my web service. This object has two properties, Method and State. Both are string fields, and I serialize a business object using a SoapFormatter for the state field. When I use the following serialization code, the web services bombs:
Dim ms as New MemoryStream
Dim soap as New SoapFormatter
soap.Serialize(ms, object)
Dim state as String = Encoding.ASCII.GetString(ms.GetBuffer())
WebService.Process(New TransportObject(state, "Save")
But when I use the following code, it works:
Dim ms as New MemoryStream
Dim soap as New SoapFormatter
soap.Serialize(ms, object)
Dim state as String = Convert.ToBase64String(ms.ToArray())
WebService.Process(New TransportObject(state, "Save")
Memes don't exist = tell your friends
|
|
|
|
|
Hi,
I'm currently writing a Word-addin.
I Successfully added a Toolbar in my addin.
I also created a Form that displays the State of Command-Execution.
The Problem is: this Form does not stay in front of the word-application.
I tried to Show the Dialog modal, that means with the Form.ShowDialog()-Function.
This also didn't work.
I think the problem is, that my Form doesn't know its owner. Any suggestions?
Thanks,
Klaus
|
|
|
|
|
Got a problem guys,
I am writing a vector game with .net and gdi+. I've run into a bit of a brick wall and I need some advice. I am writing the game in vb.net but I have a general understanding of C# so if you reply to this message with C# code I will have no problem.
The game map consists of many randomly sized rectangular obsacles placed randomly around at random rotations.
In the game you pilot a ship around the map. When you apply forward force the ship starts accelerating in the direction it is pointing. If you rotate the ship it continues along it's original path until you apply force in a different direction.
The "Ship" has a circular shield that surrounds it.
Now, I am able to detect when the ship's shield collides with a rectangular obstacle by checking wheather or not the intersection of the ship's shield region and the rectangular obstacle's region has a size.
My problem is...
I want the ship to bounce off the rectangular obstacle at the appropriate angle.
Anyone have any ideas on how to acomplish this?
I wish I could tack on some screenshots to help explain.
Feel free to ask me any questions if you need more info.
Thanks
dB
dB
|
|
|
|
|
Hi David,
I don't pretend to understand collision detection/response well at all, but I was looking into this kind of thing a few months back and I ran across an article that might help. This may be more than you need since it seems like you're talking about a 2D problem as opposed to a 3D one but I think it will work out the same. In the formulas below, V is the velocity vector of your ship, N is the surface normal of the plane you are colliding with, Vn is the velocity in the normal direction, Vt is the velocity in the direction tangential to the surface normal, and V1 is the new velocity vector you're looking for.
Vn = (N . V) * N <-- supposed to mean "the dot product of N and V, multiplied by N"
Vt = V - Vn
V1 = Vt - Vn
I got this from the following gamasutra article (and there's a picture in there explaining what the different vectors represent):
http://www.gamasutra.com/features/20000208/lander_01.htm
Hope this helps!
Phil
|
|
|
|
|
Phil,
Well I don't remember much of the math I lerned in High School, which is really my problem. Perhaps you can enlighten me.
What exactly do you mean by "Velocity Vector"? I know the velocity and the bering, how do these relate to a "Velocity Vector"?
Also, what in the world is a "dot product"?
I actually figured out how to do it after staring at the screen for several hours last night, smoking cigarette after cigarette, but my method is quite a bit more complex than the one you describe seems to be.
Thanks
dB
|
|
|
|
|