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 especially hope to understand the principle that drives you to use it despite that it is not efficient. Correct me if what I say is not true.
Another way of looking at this question can be why should we use it and why not? Is Reflection a good way of programmation?
Thank you.
http://csharp.net-tutorials.com/reflection/introduction/
http://www.csharp-examples.net/reflection-examples/
http://www.codeproject.com/Articles/17269/Reflection-in-C-Tutorial
http://www.codeguru.com/csharp/csharp/cs_misc/reflection/article.php/c4257
I'm not being arrogant by posting these links - I just think with a few mins of 'googling' you'll have the same explanation you're waiting for here anyway.
.NET Perspective
Many frameworks within the .NET framework will stop working without reflection. ASP.NET MVC is purely working on reflection.
It is powerful but the power comes with responsibility. Reflection is slow, so you need to be sure what you are doing.
Reflection gives un enormous benefits in architecturing the software.
For example plug-in base systems are almost unthinkable to be developed without heavy use of it.
It's very powerful (and in .NET very performant) feature that let's you read/write the data at runtime in dynamic and generic way.
reflection is a good technology. But its a heavy weight thing. And dont just go about using reflection every where just beacuse you learned how to use it. Use it only where really necessary.
Hope this PPT helps you learn:
http://www.slideshare.net/rohitvipin/reflection-power-pointpresentation-ppt
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.
I need to develop an evaluation tool using C# that will run on the system for hours and then will show the overal performance of the system.
The system is supposed to run a service and we want to evaluate how this service is affecting the performance of the system. Will be great if I could use the performance counters that are available in "Windows Performance Monitor"... I'm not sure if there is any API available for developers to use them.
I was just looking for suggestions...
Thanks
If it were me, I'd use perfmon. The advantages are:
Well known data archiving model that offers multiple formats.
Existing tooling to slice and dice the data, including visualization.
Integrates with other systems if the client cares (ie lets them suck the data in to other performance tooling).
Someone else's code. :)
You can wrap perfmon and invoke it programatically if you want. Worst case just invoke it via the command line and start/stop collection that way.
Of course you can also expose your own performance counters for app specific stuff too. There are loads of APIs for this for just about every programming environment I can think of on Windows, including of course C#.
I would strongly suggest you use an existing option like automating the collection of WPM statistics.
otherwise C# may not be the best choice since hardware is almost completely abstracted away from the code by the runtime. additionally the application may require sufficient resources and time to contaminate your results. usually the performace cost between C++ and C# is neglible, but in this case could be a problem.
Good luck.
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.
Please let me know the difference between C#.Net and VB.Net. I use C#.Net for my projects, but when ever I met with some other programmers they often called VB.Net more powerful and easy, than C#.Net. I always asked them "Why it is more powerful then C#, since it uses the same framework?" but still I didn't get any helpful answers.
Pointers (C#)
XML literals (VB.NET)
VB6 leftovers (VB.NET)
A few other syntax differences
In the end, not a whole lot. Although, some say C# programmers are better paid (never looked into it, but it's possible).
It also depends on your definition of 'powerful' and 'easy'. Both are powerful at their jobs. C# may have a slight advantage in terms of performance since it has pointers.. but they are rarely used in most cases.
Technically, there is no difference except the syntax. Both use the Common Language Runtime (wikipedia) (msdn). They are just two different languages that use the same libraries, and actually compile to the same thing. This is one of the reasons you can write a library in VB.net, compile it to a dll, and include that dll in a c# program.
There are some small differences, but for the most part, the choice of one over the other is almost entirely personal preference. Personally, I find the c# syntax to be less prone to errors, but some people like the "english-ness" of VB.
It's the same thing. I don't even know why Microsoft have C# and VB since it really does the same things.
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 11 years ago.
In java, Groovy, C# there are several API's available. For example lets say there is an API X which does the job of sorting. And even I have the method of my own which does the job of API x.
Which one to choose, API or my own method? What I means is, all API functions as fast as it should? Or there are cases where my method run fast than available API's?
The question is way too generic but usually you don't want to re-invent the weel. Common APIs and libraries are maintained and developed by a lot of people, are tested and optimized. Usually you will end up doing a worse job on your own.
You should invest your time implementing the things that are specific to your goal.
If you really want to be able to check what the libraries and APIs are doing there are several open source implementation that you can review and maybe also improve.
This of course depends on what do you need (which API, which task, which problem).
The unhelpful vague answer is: whichever does the job best given your requirements. The easy answer is: usually the provided API.
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 12 years ago.
can any one tell me the difference between vb.net web apps and c# .net webapps y most of the apps are done in c# rather than vb.net
There is no difference, they all compile down to the same CLR.
Nothing but preference. C# and VB.Net are extremely similar in nature as far as programming languages go.
Microsoft has said that both languages will co-evolve from now on. They will both get the same additional features with each new release, and MS is committed to both. There was a rumor that VB was going to be replaced by C#, but that is not true. They have dispelled that myth.
Because there are more coders that use c#, perhaps? Underlying philosophy of .net is that you can use language that you are most comfortable with, and stay in the same environment.
The only difference is the language that the code behind files are written in.
Both use the same objects and .NET framework, it's only a choice of programming language.
As for why most examples are in C#, more people prefer to use that.
From what I've heard, VB.NET was shoehorned into .NET as a late addition because too many programmers were familiar with it. Programmers tend to have their preferences with higher-level languages (which is by far the most distinct difference). In the end, they both provide virtually the same capability and functionality.
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 12 years ago.
I heard a lot of people saying that java is slow comparing .net, like they had servers with application on java with jboss hibernate and other stuff and it was really slow, but when they moved to .net all the performance issues disappeared. Is java really much slower ?
isthere any benchmarks made ?
I think this is going to get closed as flame-bait, but I'll make a comment, anyway.
In my experience, Java servers/services can be just as performant as .Net servers/services. It depends more on the skill and experience of the designer & developer than the technology.
That being said, it is also my experience that most Java-based desktop applications (with significant user interfaces) are horribly slow and tend to exhibit weird behavioral issues. While it's possible for an inexperienced or unskilled C# developer to create the same bad UI in .Net, it is much more unlikely that a competent C# developer will experience these types of issues when writing a .Net app, compared to a similarly competent Java developer putting similar functionality into a Java app.