Pluralize English words Like LINQ to SQL Does [duplicate] - c#

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Pluralize - Singularize
The C# 4.0 (maybe older versions, but I've only tested with 4.0) Linq-to-SQL generator will pluralize your table names; even tough plurals like Territory. It knows that Territories is the plural. Is there anyway to access this pluralization function?

System.Data.Entity.Design.PluralizationServices.PluralizationService
EDIT Linking the (older) answer in the (older) question, as eglasias suggests. Go forth and upvote, he deserves the rep.

I'm not sure the Linq to SQL inflector is publicly accessible, but if you need an inflector you could use SubSonic's inflector, NCommon, uNhAddins, Castle ActiveRecord, etc.

Related

How to create custom keywords C# [duplicate]

This question already has answers here:
Is there a way to implement custom language features in C#?
(6 answers)
Closed 6 years ago.
I'm writing a library for personal use that greatly expands C# features, and I was wondering on something quite interesting... Is it possible to create you own keywords? For example, if, foreach, for etc.
The reason I want to do this can be found at my previous question.
No, you can not do that. Language keywords are defined in the language definition. You could probably use the open sourced parts (compilers, etc) and create your own version of them.

Versioning "Rules" (Assembly/File) Visual Studio (C#) [duplicate]

This question already has answers here:
How to do version numbers? [closed]
(18 answers)
Closed 7 years ago.
I have a question regarding assembly/file versioning in Class Library project in Visual Studio (C#).
We have 4 numbers (example: 1.0.0.0) and according to:
https://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx
The four numbers are in this format:
[major version].[minor version].[build number].[revision]
My question is, how exactly do we determine "Major", "Minor", "Build Number", and "Revision"? Are "Major" and "Minor" more subjective while "Build Number" and "Revision" more objective (as we can actually count them)?
Are there any actual "rules" regarding that?
I am rather confused because according to this thread:
Best Practice: Software Versioning
basically it is a matter of preference. Can anybody clarify or having proper "rules" (with example will be best) regarding this?
Edit:
I kind of partially get the answer:
How to do version numbers?
Seems like this explains best so far. Thanks!

Adding Tooltip for Variable in IDE [duplicate]

This question already has answers here:
How to write comments / documentation for variables / fields / lists in VS 2010?
(6 answers)
Closed 8 years ago.
Is there a syntax in Visual Studio 2008 so that, in C# development, if one of my colleagues hovers over a variable, the tooltip brings up more information, like my comments? It displays that it's a local int, and while running displays a value, but I was wondering if there was a way to make it display a personal description. Sorry for the newbie question, but all my research kept bringing up very different things than what I was looking for.
This has a duplicate question, with an answer here
As I stated earlier one should use appropriate naming, and avoid using hungarian notation.

Automatic way to put all classes in separate files [duplicate]

This question already has answers here:
How can I extract all classes into separate file?
(3 answers)
Closed 9 years ago.
I've started to refactor/clean up big project. Some of files contains few small classes or few enums (yeah, it is very messy;/ ).
Is there some method or tool to automatically divide files with few enums/classes and create separate files for each of them?
As Fredrik Mörk said - Resharper is very good tool and has possibility to do what I need. But of course as almost all good tools it costs (for one it is cheap, for another not:) ).
Maybe there is some free tool for such simple refactoring? (my boss will not pay for Resharper - he told me that I need 'hammer' not a whole workshop:) )
Resharper has a refactoring that moves a type to a separate file. Might be that it can be applied on a higher level (as project); don't have it installed on this machine to verify though.
Edit: noticed in the online help that there is a refactoring called Move Types Into Matching Files that does exactly what you are asking for.
CodeRush xpress (free) also supports Moving a type into a matching file

C# - Which is faster: String.Contains() or Regex.isMatch()? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Regex.IsMatch vs string.Contains
Which is faster, preferable and why?
What the difference in mechanisms between two?
I need to search for some values from UserAgent, most of values can be used without wildcards (e.g. if I want to catch cellular phones I search for iPhone instead of *iPhone* wildcards).
What is faster
Try measuring. But this is the wrong question, see below.
preferable
If I want to match a fixed string String.Contains does just what I need. If I need to pattern match, then String.Contains is useless.
Comparing the performance of these is irrelevant, they do completely different things. Use the right tool first, and only then if your performance is a problem use profiling to identify hot parts of your code to look at.

Categories