Will there be generic attributes in C# 4? [closed] - c#

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.
So - if there isn't particular reason why there isn't generic attributes,
I'm wondering - maybe they will be implemented?
Those would be great for ASP.NET MVC action filters.

I haven't seen any evidence of this in the 4.0 spec... so I believe the answer is "no".

C# 4 specification does not mention generics in attributes.

Shame, stumbled across a case where I wanted to use this in a ValidationAttribute.
Something that can check whether a given collection is empty. In general, this could be with a generic or non generic parameter.
public override Boolean IsValid(Object value)
{
var v = value as ICollection<T>;
return v.Count > 0;
}
Would be useful if I could do this.

Related

What is the .NET alternative to the Rails stack? [closed]

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 presume that it is something like MVC4 + LINQ (or maybe NHibernate?)
I'm taking a dive into the .NET world (again) and would like to go with the best. Any tips and opinions?
There isn't an exact equivalent. You could use a combination of ASP.NET MVC + Entity Framework (NHibernate) if you want.

How extension properties syntax would be look like [closed]

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.
If Microsoft would add the feature of "Extension Properties", how the syntax of definition of them would appear? this is an article on MSDN is about extension properties (The feature that has been cut from c# 4.0).
This is pure speculation. As far as I know, even Microsoft doesn't yet know what the syntax would be. They could add a new keyword or something else entirely.
However, looking into this further, this is one possible version of the syntax:
public static TimeSpan Minutes[this int i]
{
get { return new TimeSpan(0, i, 0); }
}

suitable name for function/method [closed]

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.

NotImplemented Attribute C# [closed]

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

Why is BindingListCollectionView sealed? [closed]

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.

Categories

Resources