Black.Beard.ComponentModel 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Black.Beard.ComponentModel --version 1.0.4
                    
NuGet\Install-Package Black.Beard.ComponentModel -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Black.Beard.ComponentModel" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Black.Beard.ComponentModel" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Black.Beard.ComponentModel" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Black.Beard.ComponentModel --version 1.0.4
                    
#r "nuget: Black.Beard.ComponentModel, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Black.Beard.ComponentModel@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Black.Beard.ComponentModel&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Black.Beard.ComponentModel&version=1.0.4
                    
Install as a Cake Tool

Black.Beard.ComponentModel

Build status

Method helper for resolve types and methods.

How to use

You can use in non-intrusive mode. use the type descriptor.

Register the new TypeDescriptorProvider

GenericTypeDescriptionProvider.Register<ExampleType>();

Create a new instance for the specified type

var instance = (ExampleType)TypeDescriptor.CreateInstance(null, typeof(ExampleType), null, null);
var p = TypeDescriptor.GetProperties(i);
var property = p[nameof(ExampleType.Message)];
property.GetValue(i).Should().Be("3");

Add a virtual property

The part based on PropertyTypeDescriptor is insparated from MatthewKing / DynamicDescriptors

var instanceToBind = new ExampleClass();

var descriptor = DynamicDescriptor.CreateFromInstance(instanceToBind);

descriptor.GetDynamicProperty("PropertyOne") // Get the property using its name.
    .SetDisplayName("Property #1")
    .SetDescription("The first property")
    .SetCategory("Example category");

descriptor.GetDynamicProperty((ExampleClass x) => x.Property2) // Get the property using an expression.
    .SetDisplayName("Property #2")
    .SetDescription("The second property")
    .SetCategory("Example category");

propertyGrid.SelectedObject = descriptor;

Binding to an object instance

We can create a DynamicDescriptor for an object instance:

var instance = new ExampleClass();

var descriptor = DynamicDescriptor.CreateFromInstance(instance);

Binding to a dictionary

We can create a DynamicDescriptor backed by a dictionary. This will act as if the dictionary key/value pairs are properties of a bound object:

var data = new Dictionary<string, object>();
data["Property1"] = "hello";
data["Property2"] = "world";

var descriptor = DynamicDescriptor.CreateFromDictionary(data);

We can also supply type information:

var data = new Dictionary<string, object>();
data["Property1"] = "value";
data["Property2"] = 1;

var types = new Dictionary<string, Type>();
types["Property1"] = typeof(string);
types["Property2"] = typeof(int);

var descriptor = DynamicDescriptor.CreateFromDictionary(data, types);

What can be customized?

DisplayName:

descriptor.GetDynamicProperty("PropertyName").SetDisplayName("Property display name");

This modifies the value returned by the DisplayName property.

Description:

descriptor.GetDynamicProperty("PropertyName").SetDescription("A description of the property");

This modifies the value returned by the Description property.

Category:

descriptor.GetDynamicProperty("PropertyName").SetCategory("Category name");

This modifies the value returned by the Category property.

Converter:

TypeConverter converter = /* your custom type converter */;
descriptor.GetDynamicProperty("PropertyName").SetConverter(converter);

This modifies the value returned by the Converter property.

IsReadOnly:

descriptor.GetDynamicProperty("PropertyName").SetReadOnly(true);

This modifies the value returned by the IsReadOnly property.

Property order:

descriptor.GetDynamicProperty("PropertyOne").SetPropertyOrder(1);
descriptor.GetDynamicProperty("PropertyTwo").SetPropertyOrder(2);
descriptor.GetDynamicProperty("PropertyThree").SetPropertyOrder(3);

This modifies the order in which properties are returned by the GetProperties method.

Installation

Just grab it from NuGet

PM> Install-Package DynamicDescriptors

Copyright Matthew King 2012-2020. Distributed under the MIT License. Refer to license.txt for more information.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Black.Beard.ComponentModel:

Package Downloads
Black.Beard.Jslt

Implementation of jslt language in DOTNET. Use a template for transform Json document to another json document.

Black.Beard.Roslyn

Helper for compile Csharp at runtime

Black.Beard.Analysis

Helper for manage code analysis.

Black.Beard.Web.Server

Provide a service base for just concentrate your services

Black.Beard.Policies

The Black.Beard.Policies library is designed to help developers manage and evaluate authorization policies in .NET applications. It provides a flexible syntax for defining rules based on user claims, roles, and other contextual data. With this library, you can easily create, organize, and enforce complex access control policies, making it suitable for scenarios where fine-grained security and dynamic rule evaluation are required. It also integrates with web applications and supports external identity providers like Keycloak for authentication testing.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.196 489 4/14/2025
1.0.195 269 4/14/2025
1.0.194 258 4/14/2025
1.0.193 262 4/14/2025
1.0.192 274 4/14/2025
1.0.191 269 4/14/2025
1.0.190 235 4/10/2025
1.0.189 238 4/10/2025
1.0.188 233 4/10/2025
1.0.187 179 4/5/2025
1.0.186 250 4/3/2025
1.0.185 248 4/3/2025
1.0.184 255 4/3/2025
1.0.183 232 4/2/2025
1.0.182 253 4/2/2025
1.0.181 236 4/2/2025
1.0.180 242 4/2/2025
1.0.179 333 4/1/2025
1.0.178 225 3/29/2025
1.0.177 167 3/29/2025
1.0.176 533 3/26/2025
1.0.175 547 3/26/2025
1.0.174 547 3/26/2025
1.0.173 546 3/26/2025
1.0.172 285 3/13/2025
1.0.171 236 3/12/2025
1.0.170 237 3/12/2025
1.0.169 266 3/10/2025
1.0.168 261 3/10/2025
1.0.167 267 3/10/2025
1.0.166 257 3/9/2025
1.0.165 345 3/6/2025
1.0.164 279 3/6/2025
1.0.163 309 3/6/2025
1.0.162 191 2/26/2025
1.0.161 184 2/26/2025
1.0.160 183 2/25/2025
1.0.159 178 2/25/2025
1.0.158 187 2/22/2025
1.0.157 195 2/21/2025
1.0.156 193 2/21/2025
1.0.155 179 2/20/2025
1.0.154 178 2/20/2025
1.0.153 194 2/20/2025
1.0.152 182 2/20/2025
1.0.151 191 2/19/2025
1.0.149 205 2/17/2025
1.0.148 202 2/15/2025
1.0.147 176 2/15/2025
1.0.146 412 1/22/2025
1.0.145 183 1/15/2025
1.0.144 174 1/15/2025
1.0.143 177 1/15/2025
1.0.142 160 1/15/2025
1.0.141 163 1/13/2025
1.0.140 162 1/13/2025
1.0.139 170 1/13/2025
1.0.138 170 1/9/2025
1.0.137 191 1/9/2025
1.0.136 176 1/7/2025
1.0.135 192 12/22/2024
1.0.134 175 12/22/2024
1.0.133 177 12/22/2024
1.0.132 186 12/22/2024
1.0.131 216 12/21/2024
1.0.130 177 12/21/2024
1.0.129 190 12/20/2024
1.0.128 175 12/20/2024
1.0.127 172 12/20/2024
1.0.124 278 12/7/2024
1.0.123 394 11/17/2024
1.0.122 199 11/17/2024
1.0.121 212 11/17/2024
1.0.120 208 11/17/2024
1.0.119 218 11/17/2024
1.0.118 215 11/17/2024
1.0.117 668 10/28/2024
1.0.116 301 10/18/2024
1.0.115 185 10/16/2024
1.0.114 217 9/10/2024
1.0.113 199 9/10/2024
1.0.112 204 9/10/2024
1.0.111 198 9/10/2024
1.0.110 197 9/3/2024
1.0.109 210 8/28/2024
1.0.108 209 8/27/2024
1.0.107 225 8/13/2024
1.0.106 209 7/17/2024
1.0.105 192 7/6/2024
1.0.104 192 7/6/2024
1.0.103 205 7/6/2024
1.0.102 189 7/5/2024
1.0.101 201 7/5/2024
1.0.100 210 7/3/2024
1.0.99 192 7/3/2024
1.0.98 193 7/3/2024
1.0.97 186 7/3/2024
1.0.96 210 7/2/2024
1.0.95 246 5/5/2024
1.0.94 236 5/4/2024
1.0.93 178 5/3/2024
1.0.92 211 5/3/2024
1.0.91 450 5/2/2024
1.0.90 191 5/1/2024
1.0.89 235 4/24/2024
1.0.88 239 4/24/2024
1.0.87 202 4/24/2024
1.0.86 263 4/22/2024
1.0.85 231 4/22/2024
1.0.84 212 4/21/2024
1.0.83 197 4/21/2024
1.0.82 211 4/21/2024
1.0.81 212 4/21/2024
1.0.80 212 4/21/2024
1.0.79 216 4/18/2024
1.0.78 206 4/18/2024
1.0.77 225 4/18/2024
1.0.76 216 4/18/2024
1.0.75 215 4/15/2024
1.0.74 243 4/14/2024
1.0.73 225 4/14/2024
1.0.72 207 4/14/2024
1.0.71 206 4/14/2024
1.0.70 256 4/13/2024
1.0.69 219 4/13/2024
1.0.68 226 4/13/2024
1.0.67 216 4/13/2024
1.0.66 206 4/13/2024
1.0.65 220 4/13/2024
1.0.64 221 4/12/2024
1.0.63 212 4/12/2024
1.0.62 212 4/11/2024
1.0.61 211 4/10/2024
1.0.60 219 4/8/2024
1.0.58 395 4/6/2024
1.0.57 2,185 3/9/2024
1.0.56 223 3/5/2024
1.0.55 267 3/5/2024
1.0.54 240 3/4/2024
1.0.53 316 3/4/2024
1.0.52 555 3/3/2024
1.0.51 224 3/3/2024
1.0.50 216 3/3/2024
1.0.49 209 3/2/2024
1.0.48 1,393 2/4/2024
1.0.47 208 1/27/2024
1.0.46 265 1/6/2024
1.0.45 232 1/6/2024
1.0.44 249 1/6/2024
1.0.41 2,491 6/17/2023
1.0.40 391 6/17/2023
1.0.37 7,306 3/19/2022
1.0.36 4,714 3/15/2022
1.0.35 591 3/6/2022
1.0.34 579 2/11/2022
1.0.33 548 2/11/2022
1.0.32 559 2/11/2022
1.0.30 558 2/11/2022
1.0.29 591 2/9/2022
1.0.28 573 2/8/2022
1.0.27 550 2/8/2022
1.0.26 553 2/8/2022
1.0.25 569 2/6/2022
1.0.24 631 2/4/2022
1.0.23 602 2/2/2022
1.0.22 582 2/1/2022
1.0.21 580 1/27/2022
1.0.20 586 1/27/2022
1.0.19 586 1/26/2022
1.0.18 583 1/26/2022
1.0.17 585 1/20/2022
1.0.16 559 1/15/2022
1.0.15 589 1/15/2022
1.0.14 578 1/12/2022
1.0.13 441 1/12/2022
1.0.12 581 1/12/2022
1.0.9 420 1/9/2022
1.0.8 439 1/9/2022
1.0.7 410 1/9/2022
1.0.6 408 1/8/2022
1.0.5 13,657 12/19/2021
1.0.4 451 12/19/2021
1.0.3 472 12/19/2021