justnrik / netutilities Goto Github PK
View Code? Open in Web Editor NEWA lot of extension methods that may be useful for someone.
A lot of extension methods that may be useful for someone.
Sir, I am a Junior .Net Developer I want some experience on contributing to open source projects because I am preparing for GSOC.
This type is a wrapper over System.Type to provide high performance runtime manipulation on the given type, for example, getting/setting the value of a property without the expensive cost of reflection using the magic of Linq.Expressions. Also, each type will contain some metadata such as attributes.
Currently, I need to do major tests and add more features for more runtime manipulation. Any contribution/review is appreciated. Since this class makes a lot of one-time reflection calls, it want to keep it as lazy as possible, since not everyone will use every single member of this class so the allocation cost is lowered.
So you can more effectively document the utilities that you are providing.
The .NET SDK (in this case the project uses the .NET 5 SDK) I think it is more maintainable if the .NET SDK automatically generates the documentation xml file.
However is it required for anything, or was it just to try to avoid having it generate the file?
With a single target framework and the fact that OutputPath
is not changed in the csproj I think it's ok to replace it with <GenerateDocumentationFile>true</GenerateDocumentationFile>
.
I am working on a clone at the moment to test that, as well as split out some things that compile for .NET Standard 2.0 as well that can be used for things that should theoretically work for projects targeting .NET Standard (like the MemoryStream and Process Extensions I made before).
This is due to the fact that when this is published to nuget.org I would really like to use the NetStandard version with only the things that can compile under .NET Standard before pushed so that way those projects can drop their own copy of them for the ones I pull requested for here.
I will also retry the setup to try to get packing for nupkg's working too so dotnet pack
can be used and all the needed information would be filled in (even if it requires an Directory.Build.props
file just so that the csproj's are as small and clean as possible.
So here is my plan:
NetUtilities.NetStandard
(it will only target .NET Standard 2.0 which should be usable with netcoreapp2.0+, plus it would allow possibly some of the extensions to be used with analyzers / source generators as well since they require targeting netstandard2.0
).NetUtilities.NetStandard
inside of NetUtilities
.NetUtilities.NetStandard
and NetUtilities
for nuget.org deployment.Note: I will check and see for all the places that uses CompilerServices.Unsafe
to see if they compile under .NET Standard, if they do with the 5.0.0 package for it it will PackageReference
it, if not then those will be .NET 5 specific extensions and won't be included in the NetStandard
project.
These types are for representing 24 bits integers for some use cases, a common example would be the representation of an RGB Color.
I need to test if the types are working properly and make as many optimizations as possible to make them as performant as possible.
Hi,
Can I contribute to the Library? It seems small enough for me to practice my C# skills while learning latest language features at the same time.
I tried to build the solution in VS2019 but I'm getting the error which says : To use preview language feature, select preview language version. On StackOverflow, it was recommended to add some lines to csproj file.
<PropertyGroup>
...
<NullableReferenceTypes>true</NullableReferenceTypes>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
These lines were already there in csproj file of this solution. Any help?
It looks like the test project is missing from the solution. Can it be added to the repository so tests can be written and ran?
Note: If you want to contribute to this issue, please do it on feature-Mapper branch, Thanks.
1. Expose the following properties:
2. Data members should expose:
ConstructorData
EventData
FieldData
MethodData
PropertyData
3. Add tests to ensure all the implementation is correct.
If you want to, you can cache your reflection extensions. Something like this:
public static bool HasDefaultConstructor(this Type type) { ... }
public static bool HasDefaultConstructor<T>() => HasDefaultConstructorCache<T>.Value;
internal static class HasDefaultConstructorCache<T>
{
internal static bool Value = HasDefaultConstructor(typeof(T));
}
Note: If you help with this issue, please do it on feature-(U)Int24 branch, Thanks.
1. Add these constructors
Int24(byte)
Int24(sbyte)
Int24(short)
Int24(ushort)
Int24(int)
Int24(uint)
Int24(long)
Int24(ulong)
Int24(nint)
Int24(nuint)
Int24(UInt24)
Int24(byte[])
Int24(byte[], int)
Int24(ReadOnlySpan<byte>)
UInt24(byte)
UInt24(sbyte)
UInt24(short)
UInt24(ushort)
UInt24(int)
UInt24(uint)
UInt24(long)
UInt24(ulong)
UInt24(nint)
UInt24(nuint)
UInt24(Int24)
UInt24(byte[])
UInt24(byte[], int)
UInt24(ReadOnlySpan<byte>)
2. Properly implement the following interfaces:
Int24
UInt24
3. Add the following operators:
Int24 -> Signed Number
Int24 -> Unsigned Number
Signed Number -> Int24
Unsigned Number -> Int24
UInt24 -> Int24
UInt24 -> Signed Number
UInt24 -> Unsigned Number
Signed Number -> UInt24
Unsigned Number -> UInt24
Int24 -> UInt24
Int24 operator *(int, Int24)
Int24 operator *(Int24, int)
Int24 operator *(Int24, Int24)
UInt24 operator *(uint, UInt24)
UInt24 operator *(UInt24, uint)
UInt24 operator *(UInt24, UInt24)
Int24 operator /(int, Int24)
Int24 operator /(Int24, int)
Int24 operator /(Int24, Int24)
UInt24 operator /(uint, UInt24)
UInt24 operator /(UInt24, uint)
UInt24 operator /(UInt24, UInt24)
Int24 operator %(int, Int24)
Int24 operator %(Int24, int)
Int24 operator %(Int24, Int24)
UInt24 operator %(uint, UInt24)
UInt24 operator %(UInt24, uint)
UInt24 operator %(UInt24, UInt24)
Int24 operator +(int, Int24)
Int24 operator +(Int24, int)
Int24 operator +(Int24, Int24)
UInt24 operator +(uint, UInt24)
UInt24 operator +(UInt24, uint)
UInt24 operator +(UInt24, UInt24)
Int24 operator -(int, Int24)
Int24 operator -(Int24, int)
Int24 operator -(Int24, Int24)
UInt24 operator -(uint, UInt24)
UInt24 operator -(UInt24, uint)
UInt24 operator -(UInt24, UInt24)
Int24 operator <<(Int24, int)
Int24 operator >>(Int24, int)
UInt24 operator <<(UInt24, uint)
UInt24 operator >>(UInt24, uint)
bool operator ==(int, Int24)
bool operator ==(Int24, int)
bool operator ==(Int24, Int24)
bool operator !=(int, Int24)
bool operator !=(Int24, int)
bool operator !=(Int24, Int24)
bool operator <(int, Int24)
bool operator <(Int24, int)
bool operator <(Int24, Int24)
bool operator >(int, Int24)
bool operator >(Int24, int)
bool operator >(Int24, Int24)
bool operator <=(int, Int24)
bool operator <=(Int24, int)
bool operator <=(Int24, Int24)
bool operator >=(int, Int24)
bool operator >=(Int24, int)
bool operator >=(Int24, Int24)
bool operator ==(uint, UInt24)
bool operator ==(UInt24, uint)
bool operator ==(UInt24, UInt24)
bool operator !=(uint, UInt24)
bool operator !=(UInt24, uint)
bool operator !=(UInt24, UInt24)
bool operator <(uint, UInt24)
bool operator <(UInt24, uint)
bool operator <(UInt24, UInt24)
bool operator >(uint, UInt24)
bool operator >(UInt24, uint)
bool operator >(UInt24, UInt24)
bool operator <=(uint, UInt24)
bool operator <=(UInt24, uint)
bool operator <=(UInt24, UInt24)
bool operator >=(uint, UInt24)
bool operator >=(UInt24, uint)
bool operator >=(UInt24, UInt24)
Int24 operator &(int, Int24)
Int24 operator &(Int24, int)
Int24 operator &(Int24, Int24)
Int24 operator |(int, Int24)
Int24 operator |(Int24, int)
Int24 operator |(Int24, Int24)
Int24 operator ^(int, Int24)
Int24 operator ^(Int24, int)
Int24 operator ^(Int24, Int24)
UInt24 operator &(uint, UInt24)
UInt24 operator &(UInt24, uint)
UInt24 operator &(UInt24, UInt24)
UInt24 operator |(uint, UInt24)
UInt24 operator |(UInt24, uint)
UInt24 operator |(UInt24, UInt24)
UInt24 operator ^(uint, UInt24)
UInt24 operator ^(UInt24, uint)
UInt24 operator ^(UInt24, UInt24)
4. Add Parse and TryParse static methods and Min/Max Value constants
Int24 MaxValue
Int24 MinValue
Int24 Parse(string)
Int24 Parse(string, NumberStyles)
Int24 Parse(string, NumberStyles, IFormatProvider?)
bool TryParse(string, out Int24)
bool TryParse(string, NumberStyles, out Int24)
bool TryParse(string, NumberStyles, IFormatProvider?, out Int24)
UInt24 MaxValue
UInt24 MinValue
UInt24 Parse(string)
UInt24 Parse(string, NumberStyles)
UInt24 Parse(string, NumberStyles, IFormatProvider?)
bool TryParse(string, out UInt24)
bool TryParse(string, NumberStyles, out UInt24)
bool TryParse(string, NumberStyles, IFormatProvider?, out UInt24)
5. Add documentation to all public members (except operators)
Int24 Constructors
UInt24 Constructors
Int24 MaxValue
Int24 MinValue
Int24 Parse(string)
Int24 Parse(string, NumberStyles)
Int24 Parse(string, NumberStyles, IFormatProvider?)
bool TryParse(string, out Int24)
bool TryParse(string, NumberStyles, out Int24)
bool TryParse(string, NumberStyles, IFormatProvider?, out Int24)
UInt24 MaxValue
UInt24 MinValue
UInt24 Parse(string)
UInt24 Parse(string, NumberStyles)
UInt24 Parse(string, NumberStyles, IFormatProvider?)
bool TryParse(string, out UInt24)
bool TryParse(string, NumberStyles, out UInt24)
bool TryParse(string, NumberStyles, IFormatProvider?, out UInt24)
6. Add tests to ensure all the implementation is correct.
Int24
UInt24
Is there any documentation that will be helpful in collaboration with this project? The documentation is missing for this project so far. Can you guide me to possible resources which will allow me to contribute to this project?
This type is nothing but a wrapper of StringBuilder class. The focus of this class is to improve string manipulation and provide more utilities that StringBuilder doesn't offer.
Currently, I need to do major test to ensure everything works as intended, as well as make as many optimizations as possible. Suggestions for new members (properties/methods) into MutableStrings and tweaks in the current members are welcome as well.
These types provides a scope in which an action is executed and then it will be undo in the end of the scope.
Usage example of ActionScope:
var foo = new Foo();
using (ActionScope<Foo>.Create(foo, x => x.Value = 1337, x => x.Value = 0))
Console.WriteLine(foo.Value); // prints 1337
Console.WriteLine(foo.Value); // prints 0
Usage example of BoundScope:
Console.ForegroundColor = ConsoleColor.White;
using (BoundScope.Create(() => Console.ForegroundColor, ConsoleColor.Blue))
{
Console.WriteLine("Hello in blue!");
}
Console.WriteLine("Hello in white!");
The main difference from ActionScope
and BoundScope
is that a BoundScope
stores the old value of an object's property/field and assigns the new value, then, when the scope is disposed, the old value is reassigned. ActionScope
represents an arbitrary action defined by the user.
I want to make tests to ensure it works as intended and make optimizations if needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.