|
Hello all,
is there C# code that zip and unzip file
thank you
|
|
|
|
|
|
Maybe u are hell of a searcher then ^_^
|
|
|
|
|
Hi everybody.
There Is a way to change the initialization sequence in static constructors?
I have the following code:
<br />
class MyClass<br />
{<br />
static int a;<br />
static bool b = true;<br />
<br />
static MyClass()<br />
{<br />
a = 10;<br />
}<br />
}<br />
<br />
The compiler generates the following:
<br />
class MyClass<br />
{<br />
static int a;<br />
static bool b;<br />
<br />
static MyClass()<br />
{<br />
b = true;<br />
a = 10;<br />
}<br />
}<br />
I want that member a will be initialized before b does, but I must do it on runtime.
In other words, there is some parameter that tells the compiler to place the inline initializations in the end of the static constructor?
Thanks a lot,
Yaakov
|
|
|
|
|
No, there isn't. It looks like your going to have to design your code around this little problem and initialize the new instance of the class yourself instead of relying on the compiler to do it for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks.
I have added a suggestion in the Feedback Center.
Yaakov
|
|
|
|
|
Simply set the value of b in the static constructor, after setting a.
|
|
|
|
|
I have a C# windows application, for which I am building setup project. Since the project generates crystal reports (Designed using Version 10) I need to include merger module - CrystalReports10_NET_EmbeddedReporting.msm. I install the application on client machine and everything works fine.
BUT since this Merger mudule is so huge that in increases the app.msi file size (some where newar 50 MB). I was wondering if there is a way to split the app.msi and add a launch condition that checks the GAC if required crystal DLL are there. If not it should install the other msi that writes dll's onto GAC
Any direct or round about way to accomplish above. Basically the problem is setup is placed at a network location and due to huge size of msi it takes annoying amount of time to load installer and then to do the installation steps.
Thanks in advance
Ruchi
|
|
|
|
|
first of all thanks to Heath Stewart for his previosu responses to solve my problems,i am again with new issue=)
is there anyway to detect that IE is being closed or in short CloseEvent for IE?
i found ClosingWindow event but MSDN says it works only if window.close() is called from Jscript.
any help in this regard?
thanks
-adnan
|
|
|
|
|
Can anyone enlighten me on how to add a BeforeSelect event to a ListView control? The TreeList control has one, but ListView does not. I have a data-bound version of a ListView control and need to evaluate whether a new list item can get focus based on validation of the current item.
I have a workaround via the SelectedIndexChanged event, but I don't like it since the last selected item retains the selection (dotted) box outline even if I force going back to the old index position.
Thanks.
|
|
|
|
|
Ok this just may be very trivial. I am trying to get a unique identifier on a thread. Is this any way to get a system generated unique thread identifier or any such value which can be used in the indexer to keep track of the run.
|
|
|
|
|
Thread class does not have an intrinsic ID property of any sort. You can however creat a public property and populate it with unique data yourself.
|
|
|
|
|
The Thread class has a Name property you can use to name your threads with any name that you want to generate. It's entirely up to you what you call it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I've sometimes misused the inherited GetHashCode method to determine whether methods are called by the same thread or different ones.
It's ok for such simple purposes, but if you need reliable results it's probably not suitable, cause MSDN states that the "default implementation of GetHashCode does not guarantee uniqueness or consistency".
www.troschuetz.de
|
|
|
|
|
I appear again with more doubts this time.
First my problem description:
I am building a Client and Server which would reside on the same machine for my experiment. My objective is to study the parameters in a wireless setup and come up with a real time set of values apt for this setup,where in an ambulance has to upload data whenever it comes in the range of a hotspot. I will build a protocol using which the server and client will talk to each other.
According to my last posting, Judah Himango suggested remoting. DO I really need to use remoting procedures like the DCOM,RMI, etc for this set-up?
My other problem is: I dunno how to make both my server and client run at the same time. I use the Microsoft Visual Editor. I mean I can run only one at a time , I tried running the other from the command line, but it seems to behave wierdly, it exits giving the details of the compiler, nothing else.
kindly help me.
Sowmya Mulukutla,
Research Assistant,
Health Informatics Dept,
UAB
|
|
|
|
|
Soumya Mulukutla wrote:
My other problem is: I dunno how to make both my server and client run at the same time. I use the Microsoft Visual Editor. I mean I can run only one at a time , I tried running the other from the command line, but it seems to behave wierdly, it exits giving the details of the compiler, nothing else.
Why can't you run two instances of Visual Studio on the same machine? That's what I do when testing client / server applications.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
About your second problem, I think you're running the compiler (csc.exe) and not the application you built. Visual Studio .NET does the necessary compilation when you build your solution, you don't need to do it again. Just run the application (most probably <your_project_name>.exe).
Regards
Senthil
|
|
|
|
|
I will build a protocol using which the server and client will talk to each other.
No need, there are already protocols built in that allow one application to talk to another application. Here's an example of using .NET remoting and TCP channels to have a server talk to a client:
public interface ISayHello
{
public void SayHello();
}
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
...
static void Main(string[] args)
{
TcpChannel channel = new TcpChannel(2600);
ChannelServices.RegisterChannel(channel);
ServerSayHelloClass remoteObject = new ServerSayHelloClass();
RemotingServices.Marshal(remoteObject, "Foobar.rem");
Console.ReadLine();
}
public class ServerSayHelloClass : MarshalByRefObject, ISayHello
{
public void SayHello()
{
Console.WriteLine("Hello!");
}
public override object InitializeLifetimeService()
{
return null;
}
}
static void Main(string[] args)
{
ISayHello serverObject = (ISayHello)RemotingServices.Connect(typeof(ISayHello), "tcp://localhost:2600/Foobar.rem");
serverObject.SayHello();
Console.ReadLine();
}
So in summary, you probably want 3 projects: one project for your dll that will be shared among both client and server, a second project for you server, and a third project for your client.
Of course, the above example is very simple; you can do much much more with .NET remoting including creating your own channels, remoting more advanced objects, and so on. If you need more help, search google for .NET remoting.
Tech, life, family, faith: Give me a visit.
Judah Himango
|
|
|
|
|
Thank You all very much. I would try out what all you suggested, but surely come back with doubts....!
Sowmya Mulukutla,
Research Assistant,
Health Informatics Dept,
UAB
|
|
|
|
|
No doubt you'll have some issues, but all of them will be easily overcome. Just make sure your inquiries here are specific, it is easier to diagnose and solve a small issue than try explaining a very large subject like .NET Remoting generalities.
Hope your project goes well for you.
Tech, life, family, faith: Give me a visit.
Judah Himango
|
|
|
|
|
Hi!
In my program I've got to call a function from a third-party DLL to perform audio conversion.
Basically no big deal, but I have to be able to set the path and name of the DLL at runtime, because there are different DLLs that can be called. Each of these DLLs publishes a function with the same name and signature, but performs the conversion in a different way.
Setting the path works by p/invoking LoadLibrary() and FreeLibrary() , so that the DLL is already loaded when the function is called. This works fine.
But for my DllImport() attribute I have to give the DLL name and this name cannot be changed at runtime, as far as I know.
Does anyone know how to solve this dilemma?
TIA,
mav
|
|
|
|
|
mav.northwind wrote:
But for my DllImport() attribute I have to give the DLL name and this name cannot be changed at runtime, as far as I know.
AFAIK, this is true. You can't change the name of the .DLL that the function header is bound to.
But, you can create several function headers, each with a difference name of course (there's always a down side!), aliased to the real name of the function in the .DLL. This will also force you to write code to call each of these function names seperately.
I suspect there might be a way to use some kind of self-modifying code technique, possibly involving the Reflection namespace. But this is sheer speculation. I have no proof that this can be done or example code to show you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
You're nearly there, this article:
http://www.codeproject.com/csharp/legacyplugins.asp[^]
shows a way, but you need to write a front end dll with a win32 compiler. As you only have a single function to call, this wouldn't be a big deal I guess.
Cheers
Phil Hobgen
Southampton, UK
|
|
|
|
|
Thanks for your suggestion!
I have been playing with this thought already, but didn't really like the idea of having to add an additional level of indirection...
But if everything else fails I guess I'll use this approach.
Regards,
mav
|
|
|
|
|
How I do to implement the ISerializable interface in my custom collection? I have implemented the iSerializable for the items of the collection.
I know perfom this in XmlSerialization, but i need of more performance, then I will try the binary serialization.
Anyone can help me or tell some links?
Regards
|
|
|
|