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 have class with method that inside of it i take complex object and
from it I create new object with simple structure user can work with it
in more convenient way .I store this object instance in the memory and
and provide simple api to it.
I give it name Serializable but I'm not sure that this is the right name.
Transform
TransformToX (where X is the name of the resulting object)
ToX (you see that a lot, for instance, ToString, ToInt32)
I name methods like that using names like asThing(). I suppose in C# it should be AsThing(). Another choice might be to follow the example of Java's Number class: Number.intValue(), etc.
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 9 years ago.
Please give me regular expression formula to validate those fields. Unfortunately in this app I am unable to use java script in .ascx/.aspx page. So can I use javascript to pop up a map to locate the address in code behind file?? or what should I do?
A regex for address is not functionally possible. Pretty much anything can be a valid address. They only way to ensure integrity there is via a call to a geo location service. https://developers.google.com/maps/documentation/geocoding/ But you cannot be sure that even that would not disallow potentially valid addresses.
As for what should you do "validate and locate me" it is easiest to do a form submission and corresponding page navigation : http://www.sitepoint.com/net-form-processing-basics/
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.
Would it be classed as bad practise to have a solution called "Importer" and then have several projects called Importer.[projectname]
Imagine project name is like Importer.Model etc.
Is that good or not?
I want to confirm my thoughts with other developers
Thanks
No, it's not bad practice, as long as you choose appropriate names.
Visual Studio will assume that the project name provides the default namespace, so for a project named Foo.Bar you'll have Foo.Bar as your namespace.
This is useful when you're working on a set of libraries that fit under a parent namespace. For example, you might want to use your company name as the first part of the namespace, and the library name for the latter part, e.g. MyCorp.MailLib, MyCorp.ReportsLib, etc.
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 11 years ago.
Edit -- I'll try to make my question more to the point
I am working with the DataContractSerializer. I noticed that when I instance the serializer, I can specify the Namespace and the Name. Is there any guidance out there (or maybe a best-practice) to describe when I might want to take control of the name and namespace, and what I might want to use for the values?
I was tempted to use the namespace and class name of the class that I am serializing deserializing. Is that a good or bad practice?
DataContractSerialializer is a contract-based serializer, so forwards compatibility shouldn't a huge problem as long as you are adding - and if you do want to rename, you can hide that by adding the old name via attributes. As such, I would say "keep it simple" - trying to get clever is the cause of many bugs.
Re "What do you think?" (comments) - I think I'd rather use protobuf-net, but I'm somewhat biased :p
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.
I have an extension to the ICollectionView interface that allows me to handle multi-selection (IMultiSelectCollectionView). I want to provide an implementation that is compatible with BindingListCollectionView but that class is sealed. Does anyone know why this design decision was made?
Sealing a class usually denotes a safeguard to a derived class that might dramatically change the basic behavior of the original one. Anyway, I don't know what's the real meaning for sealing that class.