Click here to Skip to main content
15,908,931 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I want to use the properties of the Workspace class, abd I wrote this:
Workspace w= new Workspace();
But I cant create an instance from this class and I got this error:
The type 'Microsoft.TeamFoundation.VersionControl.Client.Workspace' has no constructors defined


How can I get to this properties??
Posted
Comments
Sergey Alexandrovich Kryukov 27-Feb-14 15:30pm    
This is what it is: this class cannot be directly instantiated, at all. Any problems with that?
What's wrong with just reading MSDN documentation?
—SA
Member 10304617 27-Feb-14 15:32pm    
No.
But why do you attack?
How can I initialize it?
Sergey Alexandrovich Kryukov 27-Feb-14 15:40pm    
Attack? Are you serious? I am trying to help you. Anyway, I answered. Please see the second paragraphs of my answer which should help you to understand where you were wrong, methodically. You are the one who needs it, not me.
—SA
Member 10304617 27-Feb-14 15:45pm    
I am sorry, but I saw this documents before and I did not understand, that why I come to ask here, could you please help me and tell me how to get the name of the current namespace?
Sergey Alexandrovich Kryukov 27-Feb-14 15:52pm    
Okay. The idea is to proceed logically. When you see that no constructors are available, this is not a reason to break through the problem of finding the way of constructing the instance. (By the way, this is quite possible, but we are not looking for dirty unreliable hacks, do we?) This is a clear indication that this class is not designed to be instantiated directly, so we can forget about it. But the class itself is exposed to us; documentation does not tell that this is just a part of infrastructure we should not use. Well, we are retreating and trying to look around: how this class can be useful and how this class is supposed to be used. And so on... Isn't it all logical?

So, see my answer and I suggest you accept it formally (green "Accept" button). How to use everything else would be a different question, but I hope you can learn how to read the documentation and proceed, all by yourself... :-)

—SA

1 solution

Please see my comment to the question. What are you asking makes no sense. The instantiation of this class is not accessible for the users of the library. The workspaces are created by Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer:
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver(v=vs.110).aspx[^],
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.createworkspace.aspx[^].

You need to read MSDN documentation and other sources, instead of just trying to do something without understanding of its operations. First, you need to learn how things are supposed to be used.

—SA
 
Share this answer
 
Comments
Maciej Los 27-Feb-14 16:30pm    
Vote of 1? Unacceptable! +5!

Do you have any "enemies" on this site, Sergey?
Sergey Alexandrovich Kryukov 27-Feb-14 16:36pm    
Thank you, Maciej.

Probably not many, but a couple would be enough to annoy. Most probably, this is one of those we noticed recently, the one with the reputation giving -8 for a vote.
No need to care too much... please look here :-)
—SA
Maciej Los 27-Feb-14 16:43pm    
Care-o-meter, i like it!
Belive me, you have got many friends on this board ;)
Sergey Alexandrovich Kryukov 27-Feb-14 16:49pm    
Sure, I know; this is great. And real friends are earned not by pleasing them, but by being honest, reliable and consistent. Trying to...

You know, about such kind of down-voting, which is seemingly not rational or principal, but rather just hatred-type:
Recently, I've read one strikingly clear phrase; you know, it said: "Only the slaves revenge"...

—SA
Maciej Los 27-Feb-14 17:34pm    
Revenge... Strong word!
Do you know, that april's 2010 the President of Poland, His wife and many other most important people in Poland died in air-catastrophe, near Smolensk? Some reporters claim that was an accident, but some, that was a revenge (i won't say whose). A dense fog was send over the Smolensk's airport and that was direct reason of catastrophe. What a stupid idea!
I'm not supporter of conspiracy theory. If you would like to read more about that event, have a look here[^].
I prefer positive feelings, emotions. Let's stay positive!
Revenge is caused by hate, revenge causes hate, and so on...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900