|
Thanks for the quick response, the CSharpCodeProvider class is something I will definitely use in the future. As of now everything is set up to use Reflection.Emit, HOWEVER I'm having a problem now defining an overriden property in my derived type. I'm assuming that I only have to define the get method in my derived type because the property (virtual by the way) already exists in the base type?
The error I get when I create an instance of the derived type and try to access the property is
'((Property)(derivedType)).Property' threw an exception of type 'System.InvalidProgramException' string {System.InvalidProgramException}
Any ideas?
Thanks
David.
|
|
|
|
|
Try running peverify.exe over the emitted IL - that'll give you a more clear error message.
|
|
|
|
|
Dear ALL
now i made an App C# which it write an EXE to a certain Path and it lock this file , now i need the same app to run this EXE while its locked !! ??
How?? does any one have an idea?
thanks
bye
|
|
|
|
|
Adore C++ wrote: now i made an App C# which it write an EXE to a certain Path and it lock this file , now i need the same app to run this EXE while its locked !! ??
What do you mean by "locked"?
|
|
|
|
|
this what i mean ...........
FileStream fileStream = new FileStream ........
fileStream.WriteByte .......... some where in C:\.....
fileStream.Lock
this filestram is EXE and it now locked , no other process can read it , now i need to run such EXE ??
how can i do that??
thanks all
bye
|
|
|
|
|
How would you run something that can't be read?
I are troll
|
|
|
|
|
Just a guess, you have a shortcut to the exe in your debug folder and you cannot run the app from the shortcut as it is "locked" by VS which just completed a compile?
Closing VS will free up the file - why are you running from a shortcut?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Yes, multiple even
I are troll
|
|
|
|
|
Mohamed Ibrahim Omar wrote: is there any implemented Algoritm for MD5 developed in .net
Quick Look
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
|
Good Morning ALL
I have an Arralist for example
1
2
3
4
5
2
4
3
Now i need to Find Duplicates in this array list. how can i get the Duplicated
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
You can try with IndexOf( ) and Contains() Methods
I have done with Contains(),
ArrayList Al = new ArrayList();
ArrayList al2 = new ArrayList();
Al.Add(1);
Al.Add(2);
Al.Add(3);
Al.Add(4);
Al.Add(3);
Al.Add(2);
Al.Add(1);
foreach (int i in Al)
{
if (!al2.Contains(i))
{
al2.Add(i);
}
}
Console.WriteLine("Original List");
foreach (int i in Al)
{
Console.WriteLine(i.ToString());
}
Console.WriteLine("Array List With Out Duplicate");
foreach (int i in al2)
{
Console.WriteLine(i.ToString());
}
Hope this will help you
You can even try with implement with same ArrayList.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Good Day Abhijit
Am Sorry i replied so late, i had to Look at some other Fuctionalities. I see what you are doing on the code. This will solve my Problem
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Thank you very much for your Answer. i need the Duplicates Values i don't want to get rid of them i need them in a Arraylist
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
While I would use a List<t> rather than an ArrayList, the principle is the same.
1) sort your data.
2) foreach(...) loop to spot the duplicates.
allAlbums.Sort();
#region Logging
LogEvent(string.Format(" Removing Duplicates"),
VerboseType.Verbose);
#endregion
List<Album> deleteThese = new List<Album>();
Album last = new Album("? - ? 2099");
foreach (Album a in allAlbums) {
if (a.Name == last.Name) {
#region Logging
LogEvent(string.Format(" Marking \"{0}\"", a.ToString()),
VerboseType.TooMuchInformation);
#endregion
deleteThese.Add(a);
}
last = a;
}
foreach (Album a in deleteThese) {
allAlbums.Remove(a);
}
#region Logging
LogEvent(string.Format(" ...{0} duplicates removed", deleteThese.Count),
VerboseType.Verbose);
#endregion
|
|
|
|
|
Good afternoon OriginalGriff
Thank you for your Help. Your solution is great. i have what has been posted before. but i will still look into it
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
ArrayList is too old and try to avoid unless you are on .NET 1.1.
Method 1
list.Sort();
int i = 0;
while (i < list.Count - 1)
{
if ((int)list[i] == (int)list[i + 1])
list.RemoveAt(i);
else
++i;
} Method 2
ArrayList target = new ArrayList(list.ToArray().Distinct().ToArray()); This works only when you have System.Linq namespace imported.
If you use .NET 3.5, use HashSet(T) class. It will not allow duplicate entries to be created. For .NET 2.0 or later, use List(T) other than ArrayList .
|
|
|
|
|
Good Afternoon N a v a n e e t h
The Duplicates are Created Intentional. My Client changed the Requirement. i was displaying a something like this
Staff Cycle
=============
James |4
Andrew |3
James |2
James |12
James |33
Cole |23
Daniel |56
This was Displayed in a Grid, so my Client want those with same name Displayed as a String. Now i wanted to Loop on the Grid on client side and look for the "James's" that appears more than once and put them in Arraylist or HashSet(T) after that and Display it like this
Staff Cycle
==================
Andrew |3
James |4,2,12,33
Cole |23
Daniel |56
Those that appears once , can remain with their single Value.
Thank you for your Help
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
A good approach is to use a hash table of List<int>, indexed by strings.
For each staff name, if it's not in the hash table, add it with a new List<int> containing the single cycle number.
If the staff name IS in the hash table, just add the cycle number to the existing List<int> associated with the name. Then to display the result, for each name in the hash table, write the name following by every cycle number in the corresponding list.
This approach only requires one pass through the data, and doesn't require sorting. The running time is O(n).
|
|
|
|
|
Thanks for your Advice. i have implemented the hashsets and they work like charm
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
You should take "C#" out of your sig until you learn it.
This has been asked/answered at least twice before. It's homework, isn't it?
"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
|
|
|
|
|
Good Afternoon Mr Simmons
I Admire your work i must say.
To Answer your question, this is not a homework, when you say this has been asked twice , Am sorry i have not come across it and i certainly goggled for it before i posted.
Thank you sir for your comment
Vuyiswa Maseko
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
If you don't want to have duplicates, I suggest using a System.Collection.Generic.HashSet
If you do want duplicates, but want to know about them, you may want to wrap something around a Dictionary and have the value of the Dictionary be the number of times the key was "added".
What exactly do you want?
|
|
|
|
|
Thanks for your comment. i have already implemented them.
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|