How do I easily identify classes that implement IDispose in Visual Studio? - visual-studio

Is it possible to identify classes that implement IDisposable. I was hoping to do so in the Visual Studio Color settings or with an addon.
I don't use Resharper and I have heard that FXcop has this feature. I was looking for something different than these options.

You can right click on the type and select go to definition. It should show you the public members of the class and the interfaces it implements. The object browser can also be used to see this.
However Brody's answer is usually the simplest way and works so long as someone hasn't implemented a method called Dispose but not implemented the IDisposable interface.

You can use the Class View and Object Browser to determine it. But going to the definition is the best idea as the MetaData generated will show you all the methods and the inheritance of the class

Look for the method Dispose() on the class.

Not at a risk of coming across the wrong way (so please don't take it that way), but the best way is to know your code and know the Framework. You should only need to look something up a couple of times to learn which are which. There is not really a dependable way apart from either checking if .Dispose() is a method (which always does not work, as Dispose can be private on some of the Framework classes, such as ManualResetEvent where it is protected), or by going to the definition to find it.
That is not to say that someone could not write an add-in that would do it. I don't see any issues with the technical feasibility of that. A cursory search of Google didn't turn up any existing add-ins that do it, but there might be something out there already.

Related

Completely customized UI in iOS 7

Assume you have to develop an app, which needs a completely customized user interface so that you can not use any standard UI objects in Xcode.
How would you proceed to create such an user interface? Would you use the interface builder? Would you create something like a master parent UIView? What are the best practices to achieve this?
What would be the most elegant solution with less code duplication?
If by "complete customization" you mean the look and feel of the app,
then I suggest to design the IB objects you require using some design IDE's such as photoshop and then use those slices for your project.
This is the best option I find so far to get a complete customized look with minimal code, and by minimal, I mean you don't actually require any coding. You can do this complete customization within your Interface builder.
However, I don't think you can completely ignore standard UI objects as you require them to add basic functionality.
If customized controls are what you are looking for, then I suggest you to create separate custom control classes so that they can be reused anywhere in your project, or in other projects too.
Here are two wonderful tutorials on custom controls:
http://www.raywenderlich.com/36288/how-to-make-a-custom-control
http://www.raywenderlich.com/56885/custom-control-for-ios-tutorial-a-reusable-knob
Hope this helps!

Class view in Visual studio

I see that I would benefit from using the class view in visual studio.
It would give me better overview over my classes, their methods and make it easier for me to see where and when to refactor my class. I assume that it would give me a better structure and enhance the readability of my code.
But....
I find it to awkward to use. I tried to get use it instead of solution explorer, It basically stranded before beginning. I find no similar functionality like "Track Active item in solution explorer".
Any idea on getting started on using the class view or that I just should forget it and stick to solution explorer and stay ignorant? ;)
Some years ago some people were sure that writing code will no longer exists and everything is going to be UML modeling, so I guess they were wrong.. its great power is initial model(as it name tells). Personally I found it slow clicking with the mouse and prefer writing my classes with coding..
The most important thing is to be productive. My advice is to try it (it helps in design), but if you don't feel comfortable with it, don't worry, a lof of good programmers don't know that it even exists :)

Class Designer in Visual Studio - is it worth it?

Does anybody use the Class Designer much in Visual Studio?
I have downloaded the Modeling Power Toys for 2005 and have been impressed with what I've seen so far. The MSDN Class Designer Blog doesn't seem to have been updated for a while but it still looks quite useful.
Is the Class Designer a quick way to build the basic application or should I just work out on paper and then start coding?
Thanks
As a visualization tool, or for exploratory purposes (drawing up multiple options to see what they look like) it's not bad, but generally I find the object browser does fine for most stuff I care about.
As a code generation tool, it's a terrible idea.
The whole idea that we will design all our code structure first, then fill in the blanks with small bits of implementation is fundamentally broken.
The only time you actually know what the code structure should look like, is if you've done the exact same thing before - however then you can just use your previous code, and you don't need to draw up any new code in any kind of designer.
If you decide ahead of time to use a particular class structure before you've actually tried to solve the problem, there is a 100% chance that you will pick the wrong design, and shoot yourself in the foot.
Short answer: No.
Longer answer: No, not at all. There's a reason it hasn't been updated.
[EDIT] # MrBrutal - Sorry - do you mean to generate code or just represent a design? Because I took your question as to generate code for you.
I guess this is old, but I use it a lot. It could definitely be improved, but I find it extremely useful to be able to visualize my class structure, and to be able to jump to a specific class or method by clicking on it visually.
It's also slightly easier to add classes/interfaces with than the solution explorer, although the new files always end up in the root folder, instead of the same folder as the CD.
The main benefit I find is to be able to see a group of closely related classes at once. I think the best approach might be to have a single CD for each code folder/namespace.
I've used it a couple of times to get some decent looking class diagrams to put in presentations/blogposts etc. But thats about it...
Any suggestions on other simple UML/class diagram tools that is easy to use and create some nice looking diagrams? Must be able to generate diagrams from .NET code.
I have tried it out couple of times, mainly for viewing existing classes.
If it would show all the relationships, it would be more usefull. Now it only shows inheritation.
I find it useful sometimes, more often for documentation afterwards.
It's a new little utility, but I don't think you get the full functionality in VS Pro - I think you need Architect's Edition.
The comments here suggest that few people find the class designer useful.
Amusing to note that Microsoft designed the class designer to be a useful replacement to useless UML (UML diagrams being untrustworthy once they lose synchronisation with source code).
The trouble with class diagrams is that they tell us what we already know.
I only use the class designer to display my existing classes, but I don't use it the other way, e.g., design your classes there then let it generate the code.

A good place to find frameworks with Interface Builder plug-ins…

Someone on here recently recommended BWToolkit, and it really impressed me, so I started googling for more IB plug-ins. I've found a couple on random blogs, but haven't been able to find any kind of repository/aggregator for them. Anyone know where I can find more of these?
Thanks.
I just created a page on CocoaDev to list them [edit: question originally just said “Interface Builder plug-ins”, did not mention Cocoa frameworks], with the two I know of listed.
Well that's a good start. I guess that wiki page is the de-facto repository, for now. Seems like there's not much out there.
You are not looking for Interface Builder plug-ins. You think you are, but you aren't. BWToolkit, the example you use in your question, is not an Inteface Builder plug-in. Brandon bills it as an Interface Builder plug-in but it is actually a framework and a plug-in. The framework contains the actual controls. The plug-in contains the integration with Interface Builder.
So really, what you are looking for are frameworks that contain or provide Interface Builder plug-ins. I have changed your question to reflect that, so it is more likely to be found by people using Google to search for similar things in the future.
I know what I am looking for. Not all frameworks contain IB plugins. I am looking for a specific subset of frameworks, those which contain IB plugins. An IB-plugin without a framework is useless, therefore the framework part is assumed. I am NOT looking for regular old frameworks, so stop trying to change my question to that. Your additions only seem to be confusing people.
I have reported your post, hopefully moderators will be able to stop your obnoxious behavior.
"Without a framework, what would you have to plug in to IB?"
Your words, not mine. Anyways, I'm done arguing this with you. Just remember that I can roll back for every time that you edit.
It's clear you have a lot of experience in this field, but instead of offering answers you decided to nitpick where there are no nits to pick.
Additionally, you have not "changed the question to refelct that," you have changed the question to a completely different question. I would have though that after four rollbacks you would relaize that you're doing more harm than good. Just stop, okay?
Of course, Chris Hanson is absolutely correct when he says that an Interface Builder plugin is useless without an accompanying framework. Interface Builder merely provides a graphical way to manage objects in a framework; without the framework itself, Interface Builder has nothing to manage.
However, I do think that there is a completely valid sort of Interface Builder plugin that wouldn't necessitate the installation of an accompanying framework, and that would be one that provides Interface Builder integration features for objects in Cocoa/Cocoa Touch which would otherwise appear as just generic objects.
For those of you who come to this page Google, please recognise the difference between Interface Builder plugins and frameworks: even the examples mentioned above work on frameworks (they could be Foundation, AppKit, UIKIt, etc.)

Encapsulate multiple properties at once using Resharper 4.0

When using Resharper to encapsulate a class's properties, is there a way to get it to do more than one property at a time?
You might or might not already know this (R# does suffer from a lack of discoverability, unless you get the one-page key-shortcut page printed out), but ALT-INS opens a box which can at least mass-generate properties for fields.
Not sure if that's any use - it's not the same as a retrospective encapsulation.
I don't think there such a feature out of the box.
However, you could write a RS plugin that does this. But this would be another question...

Resources