|
can anybody suggest me by giving exact difference between delegate and event
vani
|
|
|
|
|
Events and Delegates[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Delegate is the abstract way to call any method or u can say it acts like a pointer to the method.Where as event is a interrupt which is caused by the user's action and call the event handler attached with that event to do desired processing.U can make custom events by using delegates.
rahul
|
|
|
|
|
|
Hi,
I can read file/directory permissions using
ManagementPath class
and
path.RelativePath = "Win32_LogicalFileSecuritySetting.Path='c:\\oracle';
etc.
Besides, I need to read if that particular permission setting is inherited or not,
as it is seen from the image attached-the column "Inherited from"-
Is there a way?
Thank you...
Click here for sample image for permissions
|
|
|
|
|
I think I've found it.
It's like:
string dirPath = @"c:\\oracle\temp";
DirectorySecurity ds = Directory.GetAccessControl(dirPath);
AuthorizationRuleCollection arc = ds.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule fsar in arc)
{
string identity = fsar.IdentityReference.Value;
string access = fsar.AccessControlType.ToString();
string rights = fsar.FileSystemRights.ToString();
bool inherited = fsar.IsInherited;
}
string filePath = @"c:\\oracle\sqlnet2.ora";
FileSecurity fs = File.GetAccessControl(filePath);
arc = fs.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule fsar in arc)
{
string identity = fsar.IdentityReference.Value;
string access = fsar.AccessControlType.ToString();
string rights = fsar.FileSystemRights.ToString();
bool inherited = fsar.IsInherited;
}
|
|
|
|
|
How i can Send ArrayList to WebMethod ? i used this code in WebService class
[WebMethod]<br />
public void getData(ArrayList DataS)<br />
{<br />
}
and send data from clinet to Web Service like this
localhost.Service BB = new localhost.Service();<br />
<br />
ArrayList dS = new ArrayList();<br />
<br />
BB.getData(ds);
this code is not work , any one can Exp this problem ?
|
|
|
|
|
Hi,
As i want to store more than a value for a single key, i am using
NameValueCollection for storing the values.
Periodically (say for every 10 seconds), i will remove the values for
further processing with
nvCollection[Key]=null;
In this case, the null is also counted as a value. How can i
eliminate this null value.
With thanks,
Sakthi.
|
|
|
|
|
To remove values for a key, use the NameValueCollection.Remove() method.
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
Hi,
NameValueCollection.Remove() Will remove even the key .
i.e. entire key value pair will be removed.
But i want only the values to be removed retaining the key.
With Thanks,
Sakthi.
|
|
|
|
|
what do you mean by 'the null is counted as a value'?
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
u can try
if( nvCollection.Contains(key))
{
String oldkey = key;
nvCollection.Remove(key);
nvCollection.Add(oldkey,newvalue);
}
rahul
|
|
|
|
|
Hi,
I am storing data into the NameValueCollection.For every 10 seconds i
have to take the values out, for that i am using
nvc.getValues(key)
After that i am clearing the values for that key by
nvc[key]=null;
In this case null is also considered as one of the value for that
key. When i use remove, the key is also cleared.
As i want the order of the key to be preserved.i dont want to do
anything with the key.
|
|
|
|
|
Hi,
have to parse a big Textfile with about 33000 lines and at the moment this is very slow.
A colleague advised me to read the file into a buffer (byte Array) and than parse it. Thats ok, but i need the "readline" functionality.
How can i read the buffer line-by-line like the Streamreader?
I'm sure someone knows
|
|
|
|
|
I guess you could always convert the byte array into a string and then split it based on Environment.NewLine. This sounds as though it wouldn't be very performant either.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
you could use FileStream to copy the file into a MemoryStream, and later use StreamReader from MemoryStream to parse it.
<br />
FileStream fs = new FileStream("text.txt", FileMode.Open, FileAccess.Read);<br />
MemoryStream ms = new MemoryStream();<br />
<br />
byte[] buf = new byte[4096];<br />
int bytes = 0;<br />
while((bytes = fs.Read(buf, 0, 4096)) > 0) {<br />
ms.Write(buf, 0, bytes);<br />
}<br />
fs.close();<br />
<br />
StreamReader sr = new StreamReader(ms);<br />
string x = sr.ReadLine();<br />
My second computer is your linux box.
|
|
|
|
|
Hi Friend'z
I have MDI application which contains multiple forms, From Main page's main menu i have opened login form. after entering login details, i have to go to main page. i'm going to another page but login page wil not b closing. the Login form should be closed after main page is opened.
How can i do it?
pl help me friends... thanks in advance!
ITS VERY URGENT FRIEND'Z
please yar.
Raheem MA
Tr. Systems Engineer.
|
|
|
|
|
See point 1. Clickety[^]
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi!
I'm using a
ThreadPool.QueueUserWorkItem(GetData);
method to get some data (from sqldb). the GetData method is sth uses a DataAdapter object to fill untyped dataSet and returns its fitst table (Tables[0] - if != null of course)..
the problem is that the dataAdapter doesn't always fill the dataset - the table is not created when it's suppoused to be - the sql server received the querry and completed it (i checked it using profiler). well the only solution i was able to get is
<br />
int safeCt = 5;<br />
while(dataSet.Tables.Count == 0 && safeCt > 0) {<br />
try {<br />
dataAdapter.Fill(dataSet);<br />
if(dataSet.Tables.Count == 0)<br />
System.Threading.Thread.Sleep(500);<br />
} catch { }<br />
safeCt--;<br />
}<br />
for 6 out of 200 querries the fill was called twice..
well, it works, but is there any better way?!
life is study!!!
|
|
|
|
|
Doesn't the switch statement in C# support multiple options inside the case clause??? I'm sorry if I missed it.
|
|
|
|
|
No, but you can use empty case labels to achieve this. Example
switch (x)
{
case 1:
case 2:
DoOneAndTwo;
break;
}
|
|
|
|
|
blackjack2150 wrote: multiple options inside the case clause???
What do you mean?? Another switch case statement??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I mean something like this:
switch(DayOfWeek)
{
case "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" : work = true;
case "Saturday", "Sunday": party = true;
}
VB .NET for example has it and that's quite sad for me, as I've preferred C# over VB.
|
|
|
|
|
switch (DayOfWeek)<br />
{<br />
case DayOfWeek.Monday:<br />
case DayOfWeek.Tuesday:<br />
case DayOfWeek.Wednesday:<br />
case DayOfWeek.Thursday:<br />
case DayOfWeek.Friday:<br />
work = true;<br />
break;<br />
case DayOfWeek.Saturday:<br />
case DayOfWeek.Sunday:<br />
party = true;<br />
break;<br />
}
well, it works for me... think you may be doing something wrong
My second computer is your linux box.
|
|
|
|
|
Hi all,
I have a complicated form. I call that form from my main form and then close it.
After close I call GC.Collect() to ensure that all the memory used for the form has been removed. But it still exited.
I load sos.dll and use !dumpheap -stat command to show memory and see that my form and all controls and objects the form use still existed.
I debug for a long time, remove delegates, dispose disposable objects etc. but the form didnt' go.
So how can I know which object hold reference to the form? (they call them root reference as I remember). Any article, any tool to solve my problems.
It's critical, please help me.
Regards,
|
|
|
|