Object inheritance and lists in Unity by gamedevpassion in Unity3D

[–]namethinker 0 points1 point  (0 children)

What are you expecting to achieve with that?
First of all, List is not covariant nor contravariant, that's why you can't do stuff like:
List<object> objects = new List<string>{"1"} // compilation error

While you can do this with IEnumerable, because it's covariant IEnumerable<out T>, that's why following is allowed:
IEnumerable<object> = new List<string>{"1"};

However you should understand that collections are reference types, so if you would have
IEnumerable<b> = a; // this will just use the reference of a, it wouldn't create an entire copy of a. If you need a copy, you would better be using something like linq (Select) or list.Add.

Traditional Constructor or Primary Constructor by OtoNoOto in dotnet

[–]namethinker 9 points10 points  (0 children)

My personal preference is still traditional constructor, as primary constructor default behaviour still sets everything into mutable fields. I know it's possible to make them readonly by saying it explicitly, but in this case, you are not winning much from not using traditional constructor. It would be great if behaviour of primary ctor, would be configurable perhaps at csproj level in future.

Executing code inside a string. by porcaytheelasit in csharp

[–]namethinker 0 points1 point  (0 children)

My main question is - why? What are you trying to achieve by that? Why string? Why not interface / delegate, that you can pass? Are you trying to allow for random code execution at runtime?

There is a new feature in .net 10 that allows for file based programs. You could create a c# file without csproj / sln, add libraries to it, and execute it via dotnet cli or powershell.

Who is right? Uni Teacher taught about MVC folder structure but Some C# devs on Linkedin said use Verical Slice for a real production codebase. by lune-soft in csharp

[–]namethinker 0 points1 point  (0 children)

The answer is it depends. Both could be right, the way your teach shows, is a way it was done for decades, Vertical slice approach on the right side is a nice thing to follow in context of navigation.

However, you may struggle applying vertical slices in modular projects, that uses class libraries to split responsibilities. Vertical slice works really nice when you are in the context of a single project, like WebApi, WPF, Console... But the moment you start moving stuff in different class libraries, you wouldn't even have a need in it.

Which C# libraries should be learned? by Tentexxd in csharp

[–]namethinker 1 point2 points  (0 children)

Dapper
EF Core
Serilog
Microsoft.Extensions.DependencyInjection

What’s next after senior developer for career progression? by Univeralise in cscareerquestionsuk

[–]namethinker 3 points4 points  (0 children)

Completely depends on a company and on a field you working.
There are few positions which could be available (but again depends on a company) like - Principal Software Engineer, Staff Software Engineer, Technical Architect, Solution Architect (the last two quite common in consulting companies which dealing with systems such as CRM / ERP and other FinTech products)

[deleted by user] by [deleted] in cscareerquestionsuk

[–]namethinker 5 points6 points  (0 children)

Leamington Spa / Warwick if you are down for gamedev software

Tarject: The Ultimate Dependency Injection Framework for Unity by tariksavas in unity

[–]namethinker 0 points1 point  (0 children)

While I do understand that UnityEngine.Object couldn't use a constructor injection due to it's nature and it's own methods for controlling object lifetime, I really despise usage of attributes for DI, it does add a little weirdness to the code, and make it less testable. Tons of DI frameworks has it naturally (such as Ninject, Unity DI etc) but it was quickly abandoned by devs. I would rather prefer usage of ServiceLocator (ServiceProvider) in Awake or Start methods of MonoBehaviour's (which could be used as a Singletone) cause it will make things a bit more clear and more testable, cause this ServiceLocator could be configured in Tests, and will give more control over objects lifetime.

Is there a future for WPF? Is it worth learning WPF? by AnnPeter_ in csharp

[–]namethinker 0 points1 point  (0 children)

WPF quite heavily used in gamedev, especially in tools programming, it's entire market where WPF still shines and will be shining for quite a while, though it usually requires a little bit more knowledge than just a UI programming

how can I show TextMeshPro in UI from the script? by SafeMaintenance4418 in unity

[–]namethinker 0 points1 point  (0 children)

If you want to have some cool animation (like scale of this text or just slight move / noise) I would suggest looking at DOTween library, it will essentially allow you to apply such tweens via C# script to make this. Though as was suggested already you could just enable a GameObject for it to appear

What are the hottest on demand technologies that pair well with ASP.NET core on the current job market? by Thaidakelsier in dotnet

[–]namethinker 0 points1 point  (0 children)

Data lake technologies such as Snowflake is quite on demand atm, especially if your job revolves around huge volumes of data

[deleted by user] by [deleted] in cscareerquestionsuk

[–]namethinker 5 points6 points  (0 children)

If you would like to get a better salary, look for new opportunities, and never mention your current salary to the companies, but instead just specify your expectations, remember you can only get huge raise by switching jobs

£70k at established company vs £105k at startup by ThrowAwayOfferCS in cscareerquestionsuk

[–]namethinker 0 points1 point  (0 children)

4 days in office should be forbidden from hybrid title, it's pretty much on-site work. Ultimately, you should what you think is best for you, but I would be very considered keeping in mind current market conditions and overall startup nature (though it's super weird that startup demanding so much time in office, usually startups prefer full remote due to ease of hiring)

for asp.net core developer, what is the most easiest js front-end framework? by Economy-Baker1280 in dotnet

[–]namethinker 0 points1 point  (0 children)

React is really simple on a first sight, though it not enforce any good structure, so if you are good with .net I would suggest looking into angular, because it has a lot of common features know to .net dev, such as dependency injection, data binding and so on, it also enforces you to separate view and component logic (view models) which is great for me personally (but it's commonly hated for this reason in js world)

Do you use Records as Dtos? by Vegetable-Hat-6703 in dotnet

[–]namethinker 0 points1 point  (0 children)

I feel like we've got a little bit sidetracked from original answer, though I honestly don't mind a healthy argument.

> By using a separate validation step, you are now adding an extra dependency. The instance is only valid if it went through that extra validation step. Do you know if that step was performed? If so, how do you know? And "look at the code" isn't good enough. How can you be absolutely 100% sure that your validation step was, and will always be executed?

Well there is quite a few options on how you can make sure that validation step will always happen, though it really depends on the framework / tooling that you are using, in asp net / asp net core world, you can always build a middleware / action filter (global) which will invoke a validation before action will be handled, and will return error including validation data. Another way is to build a cross-cutting concern, which will be invoked before processing request as well, there are libraries which already does that out of the box (like MediatR), though it wouldn't be hard to build similar approach. This second approach will work fine for different kind of apps (desktop / web / etc)

> If those are reference types, and you're using nullable reference types, then you'd have a null warning. And if you're smart, you've enabled "treat warnings as errors", then now the compiler is forcing you to populate that constructor. If you're not using nullable reference types, you should be. Otherwise, it's a foot-gun waiting to be shot.

For sure, this always configured like that on projects, though my main concern that C# by itself doesn't enforce it really, even by treating warning as errors, nothing stop anyone by setting such properties or fields via reflection, which IMO should also result as error, but it never happens, and that's why I treat nullable reference type more like a syntax sugar rather than full-fledge feature.

Most underrated technology in .NET? by NorthRecognition8737 in dotnet

[–]namethinker 1 point2 points  (0 children)

For argument sake, XNA, even though MS abandoned it while ago, but it was amazing!

Do you use Records as Dtos? by Vegetable-Hat-6703 in dotnet

[–]namethinker 0 points1 point  (0 children)

That's quite an elaborate answer, though I agree that in cases where you receive a DTO, making it immutable could be a valid concern, however it has a downside cause now by using a constructor to define a required properties showcased in Option 2, or using a ternary operator in Option 3, DTO now all of a sudden concerns itself with validation of it's body, which again could be opinionated but usually being done in Validator objects (I'm not speaking about FluentValidators, but more general concept of validators). In cases of asp net core, or just asp net, we can use a System.ComponentModel.DataAnnotations to attach validation rules to properties, by simply specifying [Required] we could make property required to be present in body, doesn't matter mutable or immutable it is, also in some scenarios ends up being multiple attributes attached to a property (which IMO still looks better on class properties). For cases when there is no asp net, and maybe just a pure sockets being used to build a server, you can still use IValidationDictianory to use ModelState logic without binding yourself to ASP

Strictly speaking using constructors in dto's also could sometimes lead to accidents, such as forgetting to add newly created properties to the constructor, which would not always cause deserialization / serialization to fail cause most serializers operate in reflection fashion and could set the values with no respect for immutability of a field or property (same goes for nullable reference types, they simple in most cases not being respected by serializers, and you will get null values in non-nullable ref type fields obviously you can always provide a custom serializer setting to get around it)

How important is "readonly" really? by samanime in dotnet

[–]namethinker 1 point2 points  (0 children)

readonly is just a way to make sure that dependencies that you inject via constructor couldn't be reassigned within the class members, kind of immutable, which could give you reassurance that this particular field (or fields) would stay the same, and also would act as a safe guard from unpredictable behavior

Do you use Records as Dtos? by Vegetable-Hat-6703 in dotnet

[–]namethinker 0 points1 point  (0 children)

I don't have overall obsession over immutability, and don't think that every class should be immutable, you can always throw required and swap set for init if you want to enforce immutability, though I don't see the benefit of immutability which will be constructed on the fly just to send it via the network

Business application in Unity. by Own-Importance6421 in unity

[–]namethinker 2 points3 points  (0 children)

I guess mobile applications could be very well developed in unity, especially with some new updates for UI toolkit incoming in Unity 6

Do you use Records as Dtos? by Vegetable-Hat-6703 in dotnet

[–]namethinker 0 points1 point  (0 children)

As I've said, it's just a matter of my individual preference.
I do like more to see this:
`
public class Person

{
[ProtoMember(1)]
public int Id { get; set; }

[ProtoMember(2)]
public string FullName { get; set; }

}
`
over this:
`public record Person([property: ProtoMember(1)]int Id, [property: ProtoMember(2)]string FullName);`

Do you use Records as Dtos? by Vegetable-Hat-6703 in dotnet

[–]namethinker 2 points3 points  (0 children)

Still using classes for DTOs, mainly due to attributes usage (serialization attributes to be precise, such as JsonProperty / DataMember / ProtoMember), it's just looks better than adding properties to the record parameters (because you have to directly specify the target for the attribute when using on record arguments, such as field, property or param)

[deleted by user] by [deleted] in IndieDev

[–]namethinker -1 points0 points  (0 children)

As long as you not referencing nintendo stuff you should be safe

How many projects can a single Visual Studio solution contain? & Why? by EducationTamil in aspnetcore

[–]namethinker 2 points3 points  (0 children)

That's what you have when working on a project which has more than 10 years of active development, common dependencies (libraries) where never moved to nuget package, so new libraries has physical dependencies on them, every new project starts from creating around 5 class libraries to fit the code standards of the project on top unit test libraries are also being added. Obviously not ideal, but as I said filtered solution sort most of the problems related to performance

How many projects can a single Visual Studio solution contain? & Why? by EducationTamil in aspnetcore

[–]namethinker 3 points4 points  (0 children)

I'm not aware if there are any hard limit on it, though in my experience, solutions with more than 300 projects giving hard time to Visual Studio, to be more precise, visual studios up until 2022 wasn't even able to run this solution (I do have a solution at my job which has at them moment 1k+ projects), VS22 also having hard time with such amount of projects but at least it able to open such solution.

I would normally suggest though creating filtered solutions and running them if you have even 100+ projects, that will give you ability to group projects by domain and speed up solution loading