I am pretty new to C# but I have worked a little bit for my classes. When I worked in C#for classes, our teacher used to tell us the namespaces that we needed for completing the assignment.
I wanted to know where do I find all the collection of the namespace for C#.
One of my friends directed me to this site
https://learn.microsoft.com/en-us/dotnet/api/index?view=netframework-4.0
but some of the namespaces did not work for example,
enter image description here
I am working on a small project with ASP.NET MVC and wanted to try different namespaces
I think you may be a little confused, or are possibly not asking the question correctly. The link you provided does contain a list of the different libraries (namespaces) available in the C# API.
If you try to use a namespace in your own code, and it does not resolve, you may need to add an assembly reference to bring that namespace into your project. VS usually does a pretty decent job of guessing what assembly, or missing using statement is required if you either press alt+enter, or click the context drop down under the missing library (denoted by the red squiggly).
Either way, you should just start coding your MVC project, and then google the issues you come up with directly. Asking for all the namespaces is very very vague.
Related
So I have a C# (asp.net) based dashboard for a proprietary content management system. One of the things that the dashboard allows is for the user to go in and add custom css/sass to their site. When they do this, my controller calls a program that compiles the sass using NSass.Core.
Up until now, I have been using Foundation 5 as my responsive framework. Yesterday when attempting to update my controller to allow for Foundation 6 compilation, it started throwing errors. The errors were occurring every time the compiler attempted to parse a sass map (associative array).
I started doing some research into the problem and found out that sass maps are a relatively new mechanic in sass and the last time Nsass was updated was three years ago, so I am assuming this is the problem.
Has anyone had similar experience? If so, what was your solution. If not, does anyone use anything else that would work for me? I have tried installing a couple other packages, but started receiving various other errors such as libsassnet not being able to find the 32 bit dll. Hopefully someone here can give me an answer that saves me some time.
The errors I have received when using Nsass were all along the lines of "error reading values after primary" where primary is the first value in the first map the compiler comes across. When I take that map out, it just moves to the next one and gives the same error.
As far as narrowing my question down... I just want to know what other people are using out there to compile Sass in C#
There is a nuget package: Bundle Transformer: Sass and SCSS is a provider for Bundle Transformer. In turn, this is an extension of System.Web.Optimisation that could allow you to add code to your CMS to compile user generated SCSS into Css files.
An example of this can be found in the Optimus package for the Umbraco CMS. Looking through this code could give you a good basis for creating your own system. If you speak with the Author of the package (a really nice guy) he might be able to help you create your own targeted package that isn't dependent on Umbraco.
Hope that helps.
I am looking for a technique to find all the wrong namespace in solution.
With wrong namespace I mean all the namespaces that have a different from the current location.
For e.g.: If I have a project called MyCompany.MyProject.Frontend and I have a class under the Controller folder, the final namespace should be:
MyCompany.MyProject.Frontend.Controller
How can I find all the namespaces that doesn't follow this standard?
I know that Resharper offers this feature but currently we don't have a license for it.
Is there any free solution to this problem?
Why not just download and install the trial version, do what you need, and be then get rid of R#?
Otherwise, writing a simple parser with a search and replace shouldn't be hard, just "fiddly" and time-consuming to get exactly right.
However, as soon as you do this, you are going to run into the problem that all of your previous includes statements will need to be modified to include the new namespaces, which R# will do for you as part of it's operations.
Seriously, just use R# as a free trial, and get what you need from it. Even better, just buy a copy for yourself... I've gotten my $150 worth.
This question is a followup to an earlier question and subsequent questions raised by research on MSDN per the links provided in the answer.
Here's an image of the solution explorer I've set up so far & I want to make sure I'm on the right track organizationally.
First, because VS2010 is for a C# Class I'm taking, I'm organizing a ProgrammingClass solution (ITDEV110) and Assignment projects (ASSN3a, ASSN3b) within that solution. I read somewhere that a solution is like a house and a project like a room...so this makes good organizational sense to me.
Given that organizational strategy, I can't find the best way to save a copy of Assignment1 as the basis of Assignment2. Sometimes I get proj2's *csproj file in the proj2 path, but the *cs files in the proj1 path. Other times, my *cs files show up in solution explorer as a dotted outline icon (not the *._cs in the pic). I can still click, edit and save, but they still look like ghost classes in explorer--and I'm not sure what that dotted ghost line means to the compile and run.
So how can I move *cs files between projects in a single solution without
confusing VS2010 into thinking it has two Mains, and
ensuring the right versions of classes and methods are called?
Is it just a matter of "Save As..." a new project name? Or should I create a new project from existing code? Is this a job for namespaces? How does this differ if I want SOME of the code from #1 to BE accessible from #2?
I've been doing a lot of creating new classes for my programs by cutting-pasting from notepad...but I know there's got to be a better way.
Any resources or tips would be awesome.
Create a new different C# project for each programming assignment you get. Feel free to use the same Solution, but it's best to keep projects separate. It is possible to share files between projects (using Linked files), or references types and classes from other projects using Project References, but putting school work code into the same C# project is a lesson in pain.
I've been tasked with moving the more useful parts of my code into a dll (if possible) for ip protection and to stop other developers changing parts that don't need to be changed.. I'm curious on how best to handle the namespaces and method parameters that relate to classes that I have created..
Is it just as simple as making sure they are in the same namespace? I get the feeling this will cause problems for others when the dll is to be used in other applications..
The only other viable solution I can see coming forward is to move my class variables into this new dll and then use them under this namespace..
If its needed im using winforms
I don't see how moving the code to a dll will protect your IP better.
That being said, my suggestion is just to copy the code to minimize the amount of the client code which needs to be rewritten. You will more likely need to change some classes from internal to public, or at least some methods visibility.
There is no reason that keeping the same namespaces will cause troubles for using the dll in other apps if your namespaces are even moderately sensible. In worst case, you can alias the namespaces/class names (with using directive) in the client apps to solve the issues if there are any.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am considering releasing one of my class libraries written in C# as open source. Before doing that, I am trying to do some refactoring so that it meets the demands of the general public :)
I wonder what would be the best namespace schema to use? Basically, I see the following options:
namespace MyTool: This just doesn't really look like organized for me. I mean, (almost) all the namespaces in the .NET Framework are prefixed with System so I guess it is not really a standard way to do it.
namespace MyOrganization.MyTool: The problem with that there is just simply no "MyOrganization". It is written in my spare time.
namespace MyName.MyTool: I would prefer something more humble. I mean really, I don't want to have my name in the namespace.
Now there are a couple of related questions on Stackoverflow already, like this and this, but none of them really answer my question.
Any suggestions?
I'd go with something like:
namespace OpenSourceProjectCodeName.MajorFunctionalArea
For example:
namespace VideoWizardMagicThing.Audio
namespace VideoWizardMagicThing.Audio.Codecs
namespace VideoWizardMagicThing.Video
namespace VideoWizardMagicThing.Video.Codecs
You don't have to go completely mad with namespaces and all you may need is one or two MajorFunctionalArea's. However without knowing how the project is structured or what it does it's hard to say.
If it's open source and there will be contributors I would pick MyTool.
If you can afford to change it later, I'd go with MyName.MyTool. If you are the only person writing the tool, you need full credit, and having your name in the namespace doesn't hurt anyone.
If you take on new contributors, you can remove your name from the namespace but only if other people actually made a big contribution. If the majority of work is yours, I'd leave it in.
MyTool has the problem that names aren't unique; you’re heading for name conflicts. MyCompany.MyTool doesn’t apply in your case if you don’t want to give yourself some label.
I actually rather like the Java convention of reversing the URI associated with the product. For companies, this is the company website. For you – do you have a blog / personal homepage whose address isn’t likely to change soon? Then use the name, with TLD and second-level domain reversed. In my case: net.madrat.MyTool.
I know a few people who use TheirName.MyTool which is fine. Howver, this becomes a problem as soon as there is a second contributor.
I would suggest getting a MyOrganization and using it. If you ever take money for the work, you are going to need an entity, and it could protect you from liability. It is fairly easy to set something up.
Or just use a MyOrganization name and create the entity later, but you run the risk of legal name conflicts, etc if you don't set it up first.
You could do MyToolProject.MyTool. Or, you could just come up with some creative name for your "organization" and just have that as what all your future open source projects will be, even if it is just one right now. Then you could have MyCreativeOrgName.MyTool.
MyTool sounds pretty much like the project code/brand name?
In that case if you wish to categorise it further without using your organisation or personal name, hook on the industry or problem domain it is meant to address.
VideoEditing.MyTool
Accounting.MyTool
HomeAutomation.MyTool
MyOrganization.Technology is still the recommended way to start the namespace with.
I used to have similar problem of namespacing my hobby the projects before. So I've just made up the name for the development group of one (you want to have a short and readable one) and started using it.
However, keep in mind that the usability is still the key. For example, here's is one exception from the rule. Our open source Lokad Shared Libraries are following namespace of the .NET itself (i.e.: System or System.Threading). That's because there are numerous everyday helpers and extensions that should be available for our developers without even noticing that they are leveraging non-BCL code.
It also makes the using declarations look nicer.
I ended up with Idunno.* for a couple of projects (my web site), and SharpSTS.* for the main one (as that's the project name)