Questions tagged [.net-attributes]

The tag `.Net attributes` describes anything related to using or creating attributes in .net source code. It is specifically meant for classes derived from the `System.Attribute` type.

.Net attributes describe the creation and usage of attribute classes in .Net program code (C#, VB.Net or otherwise). .Net attributes are derived of the System.Attribute class, and can be applied to methods, classes or assemblies.

Assembly version is described using Assembly attributes:

// Set version number for the assembly.
[assembly:AssemblyVersionAttribute("4.3.2.1")]

Classes can be decorated with attributes to denote special usage:

[TestClass]
public class MyTests 
{
    ..
}

Methods can be decorated using attributes:

[TestMethod]
public void MyFirstUnitTest() { .. }

Even parameters can be decorated using attributes.

33 questions
0
votes
1 answer

Simple Injector inject dependency into custom global authentication filters and OWIN middle ware OAuthAuthorizationServerProvider

I used Simple Injector as our Ioc container; we have two problems. We want to inject into our custom authentication filter; we read the post of converting attribute to a passive attribute: Convert Attribute into a passive. But we can't convert…
-1
votes
1 answer

How can I both dependency injection and send value inside the attribute in .net core?

I want to decrpyt the request and encrypt the result by attribute. For this, I wrote the CheckFilter attribute below. But I need to do dependency injection to use IHashService service in it. I also want to send a value with attribute as it is used…
-1
votes
3 answers

what are ["foo bar"] lines in c#?

So I'm coming over from Java, and I've been seeing (and using), a ton of these: ["foo bar"] void method(param params) { ..code things } Can someone explain to me what they are? I don't even know what they're called, so I can't manage to figure…
Scuba Steve
  • 1,541
  • 1
  • 19
  • 47
1 2
3