|
You could always try this one:
http://nprof.sourceforge.net/Site/Description.html[^]
I believe that the profiler you are looking for in .NET is in VSTS (I only have Professional so I can't help you there).
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Tristan Rhodes wrote: Apparently .net has one built in, but i can't find anything about it.
That depends on which version of Visual Studio .NET you're using. 2002 and 2003 don't have them, but 2005 does, and it depends on which Edition of VS.NET 2005 you have.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Which versions of VS.NET 2005 have a built in profiler. I use VS.NET 2005 Academic Standard Edition.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Professional and above. None of the Academic versions have any profilers.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
What's the meaning of casting from a class to an interface?
|
|
|
|
|
It means that you tell the compiler that instead of the reference to a specific class that you have, you want a reference to the same object but the type of the reference should be one of the interfaces that the class implements.
---
b { font-weight: normal; }
|
|
|
|
|
I know, but what is the need of doing this? Why should someone do this?
|
|
|
|
|
Hendrik Debedts wrote: I know
So that's why you asked?
Hendrik Debedts wrote: but what is the need of doing this? Why should someone do this?
To get a reference to an interface. If you for example use the Array.Sort method with an IComparer , you need a reference to an IComparer :
Array.Sort(SomeArrayOfMine, MyOwnComparer);
Here, the reference to the MyOwnComparer object is implicitly casted to IComparer .
---
b { font-weight: normal; }
|
|
|
|
|
Yes ok, but if you can cast an object to an interface, it means that the class of the object implements the interface and when the class implements the interface you don't have firstly cast the object to the interface
|
|
|
|
|
You wouldn't cast a class to an interface, it's unnecessary. But you may need to go the other way.
If you have two classes (A and B) that implement an interface (I), you may have a method that takes a parameter of type I
public void F ( I i )
then inside the method you may need to cast the parameter to it's actually type (however, this may be poor style)
<br />
{<br />
if ( i is A ) { (A) i = blah blah blah }<br />
else<br />
if ( i is B ) { (B) i = blah blah blah }<br />
else throw something perhaps<br />
}<br />
but when calling F you needn't cast your instance to I
<br />
A a = new A() ; <br />
F ( (I) a ) ;
F ( a ) ;
|
|
|
|
|
PIEBALDconsult wrote: You wouldn't cast a class to an interface, it's unnecessary
This is sometimes necessary. If you have a class that implements two interfaces, each with a method of the same name you will need to explictly cast to the appropriate interface in order to access the correct method.
public interface IList {
public void Add(object x);
}
public interface IDictionary {
public void Add(object x);
}
public class Test : IDictionary, IList {
}
Test t = new Test();
((IList)t).Add(x);
((IDictionary)t).Add(x); Without the explicit cast the compiler will not know which Add method you intended to call.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Ew.
I sit corrected. I should have put in more qualifications like "usually unnecessary".
But then you're probably getting into the reason C# only supports single inheritance.
|
|
|
|
|
PIEBALDconsult wrote: But then you're probably getting into the reason C# only supports single inheritance.
Yep. I was approaching this from a C# viewpoint, which does support single inheritance for the base class (you can inherit from as many interfaces as you want).
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hendrik Debedts wrote: when the class implements the interface you don't have firstly cast the object to the interface
Yes, sometimes you have to.
You can't call a method using parameters of the wrong type. If a method expects an interface reference, you have to use an interface reference. You can't use the object reference, as it's not the correct type.
---
b { font-weight: normal; }
|
|
|
|
|
Oh yes you can, this code compiles without any problem
Here you pass an object of a class who implements the System.Collections.ICollection interface (Person) to a method that has a System.Collections.ICollection attribute (static void aMethod(System.Collections.ICollection i))
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Person oPerson = new Person("Hendrik Debedts");
aMethod(oPerson);
Console.ReadLine();
}
static void aMethod(System.Collections.ICollection i)
{
Console.WriteLine(i);
}
}
public class Person : System.Collections.ICollection
{
public string msNaam;
public Person(string sNaam)
{
this.msNaam = sNaam;
}
public override string ToString()
{
return this.msNaam;
}
public void CopyTo(System.Array array, int index)
{
}
public int Count
{
get
{
int anInteger = 0;
return anInteger;
}
}
public bool IsSynchronized
{
get
{
bool aBoolean = false;
return aBoolean;
}
}
public object SyncRoot
{
get
{
object anObject = new object();
return anObject;
}
}
public System.Collections.IEnumerator GetEnumerator()
{
System.Collections.ArrayList arl = new System.Collections.ArrayList();
return arl.GetEnumerator();
}
}
}
|
|
|
|
|
Hendrik Debedts wrote: Here you pass an object of a class who implements the System.Collections.ICollection interface (Person) to a method that has a System.Collections.ICollection attribute (static void aMethod(System.Collections.ICollection i))
...Thereby causing an implicit cast of the reference. Exactly as in the code I showed earlier in the thread[^].
Just because you don't explicitly write the code for the casting, doesn't mean that the code you write doesn't do a cast.
---
b { font-weight: normal; }
|
|
|
|
|
I would only use the term "cast" when it's explicit, not when it's implicit.
|
|
|
|
|
Then what would you call it?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am student of final year engineering student. I selected “SMS Website” as my project topic. In this I have to send Bulk SMS through website and provide other kind of services related to SMS.
Please tell me which steps I should follow to make this kind of software.
Please send me some material or any kind of source code related to it.
I need your help.
Thank you!!!
Contact Me: ashish.0619@gmail.com
|
|
|
|
|
Someone is using this?
Why me, a asp.net developer, can to need use this in the practice?
(I'm not ranting against WWF, just with sincerity, learn why I must stop some time to learn a new paradigm, what I never needed until now)
Regards
For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.(John 3:16)
|
|
|
|
|
So don't use it. Really.
It really only gets good for things where you need to process items in a specific controlled sequence.
|
|
|
|
|
We have a CMS that allows the user to upload documents, which must be classified and approved before others can see them. We had to write a lot of "plumbing" code to do this relatively simple operation. In the next version of the CMS, this will be handled by the Workflow engine (along with other parts such as the whole content approval process from design through to deployment).
Seriously, you don't need WF. You can write your own code to do what it does, but why would you want to? It's free, and it does what it says - it handles the workflow for you.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I try to terminate the application from other library of main library. The scene like this.
1st at the main library I reference the second library.
2nd at the Application.Run I attach form from second library (call formx).
3rd at formx I try terminate the main application call Application.Exit().
The phase third is not passed, so anyone have experience to terminate application from other assembly, I try to manage my project (each controls, classes, forms, etc. have it own libraries).
Thanks.
|
|
|
|
|
That's not proper form. A library should NEVER determine when an application should terminate. It should only send back exceptions or some other signal that the root of your application uses to determine IF it should terminate or not, then take proper action on its own.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|