say | firefly fanatics
inheritance vs nested class
Suppose i want to create a Resources class. There are three type of resources: string resources, drawable resources, xml resources. Which one is better to implement the resources class: inheritance or nested class ?
With inheritance, i create abstract class Resources, then create another class for each type of resources which inherit from Resources.
With nested class, i create a static class Resources, then create a non-static class inside the Resources class for each resources types. For example, Resources.String, Resources.Drawable, etc.
5 replies
fastest way to check if list doesn't contain null ?
I have a list of reference type (for example, list of string) as constructor parameter. Now i require that all of the list element must not be null. Everytime the object instance is created, the constructor will loop through the list to verify that none of the element is null. However, this have performance impact to immutable class where any modification require creating new instance of the class (because immutable class can't be modified). Is there faster way to check that list element cannot be null?
25 replies
How to target .net standard in visual studio
when i create new project, the target framework that i can choose is only .net framework, there is no .net standard. I installed .net core 3 in my pc and .net standard still not shown, then i installed .net core 3.1 runtime in visual studio and .net standard still not shown in target framework. How do i target .net standard ??
5 replies
Whats the difference between Workspace and AdhocWorkspace?
Im currently trying to learn roslyn api. In Microsoft.CodeAnalysis namespace, there is two classes named AdhocWorkspace and Workspace. Whats the difference between these two? Which one i should use?
17 replies
where can i learn roslyn compiler api in easier manner?
I want to learn how to use the api provided by roslyn compiler, but i cant find any good tutorial about it. There is the roslyn api tutorial at learn.microsoft.com but it only scratch the surface and didnt go beyond just a small example of code. I tried reading roslyn api documentation (also at learn.microsoft.com), but it contain so many jargon that i dont understand yet. I tried reading the source code at github but gave up because it uses visual basic language which i dont understand.
Does anyone know easier way to learn roslyn api without reading the documentation one by one and try to figure out how it works?
Is there a standard specification for roslyn compiler api? I tried reading C# standard specification by ECMA and it really helped me to learn C# in depth easier than randomly browsing on internet, so im thinking whether there is standard specification for roslyn compiler api
17 replies