As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am working on Unit Testing for my current project and came across something odd. The .Net UnitTesting library has both Assert.Equals and Assert.AreEqual. The remarks for Assert.Equals say to use Assert.AreEqual to compare two objects, but gives no reason as to why to do so over Assert.Equals. Can somebody explain when you should use Assert.Equals in unit testing, if ever and the difference between Assert.Equals and Assert.AreEqual?
Assert.Equals is just the Equals method inherited from object. It has nothing to do with unit testing, and in fact, has no use.
To be more precise, Assert.Equals is exactly the same as Object.Equals. Object.Equals has a use.
However, if you're using Assert.Equals, then you're probably confusing it with Assert.AreEqual, and you want to stop using it.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Smalltalk supports a syntax feature called "message cascades". Cascades are being adopted by the Dart Programming language.
As far as I know, C# doesn't support this. Were they ever considered during the design of the language? Is it conceivable that they could appear in a future version of the language?
In VB.Net there is the with keyword which I believe is used for this purpose (correct me if I'm wrong on this), however in C# they decided that it can often hurt readability and left it out (good in my opinion).
Some short details can be found at the below link, however the link to the microsoft page is no longer working:
http://blogs.msdn.com/b/csharpfaq/archive/2004/03/11/why-doesn-t-c-have-vb-net-s-with-operator.aspx
Note: If anyone has the following link archived I would love to read it (as the link is not working):
http://msdn.microsoft.com/vcsharp/team/language/ask/withstatement/default.aspx
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
A simple question: Why there isn't any NotImplementedAttribute in C#?
You can always throw the exception, but I think it would be nice for this to work as the
ObsoleteAttribute -> you get an warning for using that method.
Ok, you have a method with this attribute, and when you implement it you have to remove the attribute by hand, but I think this is safer than using methods with throw new NotImplementedException() inside...and wait for them to get called.
I remember reading that the Obsolete is hard coded into the compiler, but maybe there is some spare room for this one :)
This is just my opinion, maybe I am wrong. But it's something that I would like to see.
Thanks
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Is there a free .NET implementation of an algorithm that calculates alpha-shapes (aka concave-hull)? Alternatively, an implementation of this algorithm.
I know of this and this thread, but there's nothing specific for the .NET eco-system.
If the answer is simply 'use CGAL + a c# wrapper', then can you please point me to the wrapper as I could not find one, and a sample on how to use CGAL for alpha shapes. The CGAL reference manual on alpha-shapes is difficult to follow. Specifically, the goal is to take a set of lon/lat points and find an "outline".
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm creating a web-related application and I want to add plugin support to it. But I want the plugin dlls to be restricted from everything except my SaveSettings(), RequestPage() and SendToHost() methods. Any good examples how to do that?
You can require your plugins to implement an interface which contains those three methods. In your code then you would call those methods where it is necessary to apply the plugin functionality.
Of course this will not prevent them from executing code within those methods that is not desirable. This becomes more of a security problem in this case. I can't think of a straightforward way of doing this except to load the plugin assemblies into another AppDomain and set security restrictions on the AppDomain about what they can do. This will also of course complicate how you pass data between your plugin and your code.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Does anyone know of an open source financial library that implements Yield To Maturity and other fixed income calculations? The library needs to be callable from .Net.
Here is a .NET implementation of all of Excel's financial functions, including yield to maturity.
Have you looked at Quantlib? Seems to offer a wide array of pricing tools and is callable from .Net, I believe. There's also a port to Java called JQuantLib as well, though I don't believe it implements everything in Quantlib quite yet.