Quantcast
Channel: User Sinatr - Stack Overflow
Browsing all 350 articles
Browse latest View live
↧

Image may be NSFW.
Clik here to view.

Giving file in the project a name A.Designer.cs will make it nested to A.cs

I just discovered an interesting feature of Visual Studio (using VS2022), renaming existing class or creating new with same name as another class plus ".Designer" will make it nested to another...

View Article


Answer by Sinatr for Giving file in the project a name A.Designer.cs will...

I'd say it wasBad ideaCertain features are not working inside such ".Designer.cs" file.Some (all?) warnings are not shown (e.g. C8618) for classes inside this file. The compilier errors are shown and...

View Article


Record inheritance, is there a convenient syntax, perhaps on the way or not?

I am trying to utilize records to reduce amount of boilerplate code and immediately spot the inconvenience of need to redefine all arguments of base record:public record A(int a1, int a2, string a3,...

View Article

Answer by Sinatr for C# create derived record from base record instance

You can go with copy constructors (fiddle):public record root (string name);public record extended (string surname, string name) : root (name){ public extended(root copy, string surname): this(surname,...

View Article

Answer by Sinatr for How to change Panel Border Color

You can create own Panel class and draw border in the client area:[System.ComponentModel.DesignerCategory("Code")]public class MyPanel : Panel{ public MyPanel() { SetStyle(ControlStyles.UserPaint |...

View Article


Image may be NSFW.
Clik here to view.

Answer by Sinatr for Rectangular button with a progressbar along the contour...

It's combination of several questions, including:how to draw circular progress;how to clip rounded rectangle...I quickly pack few things together to get you started. There is still work to do...

View Article

Why using null-conditional operator in nullable context breaks static analyzer?

Why after using null-conditional-operator in nullable context (#nullable enable) the static analyzer shows CS8602 warning?var test = new List<int>();Console.WriteLine(test.Count); //...

View Article

Read-only (visually) CheckBox

I need to have 2 groups of controls on the screen: inputs and outputs (so they have 2 states: On or Off). Thus CheckBox seems to be a good choice. Checking any output will set it.However, when...

View Article


Answer by Sinatr for Why application crashes after signing?

This cryptic error doesn't tell about specific reason of the crash, which in my case was missing entitlement. Sure, it's code-signing related, but... /sighIf someone could post an answer, how to find...

View Article


Why application crashes after signing?

The problem is that my app bundle works before signing and crashes if I use codesign and I am absolutely clueless as to how find out the reasons. Can someone push me in the right direction?I am getting...

View Article

ScrollIntoView and ListView with virtualization

I have ListView (virtualization is on by default), which ItemsSource is bound to ObservableCollection<Item> property.When data are populated (property is set and notification is rised) I see 2...

View Article

Is it possible to customize only single member output without rewriting...

I have record with many members and I want Console.WriteLine(myRecord); to output its values. However one of its members is an array and it will be printed as MyOtherRecordType.Item[]Is there a an easy...

View Article

Memory leak, but where?

I can't understand what is leaking hereusing GDI = System.Drawing;public partial class MainWindow : Window{ [DllImport("gdi32.dll")] private static extern bool DeleteObject(IntPtr obj); public...

View Article


WhenAnyValue filtering

How can I filter WhenAnyValue values, similar to use of .When() in LINQ?The story: I am performing filtering inside the subscriber (full code is in my other question):vm.WhenAnyValue(o => o.Foo, o...

View Article

Image may be NSFW.
Clik here to view.

Answer by Sinatr for Accessing dynamic view within ExpandoObject

You can surely do a lot to enhance your debugging experience. Here is my quick attempt:I had to use composition to extend sealed class ExpandoObject with attributes:class MyExpando{...

View Article


Answer by Sinatr for How to avoid stale values when using WhenAnyValue and...

To demonstrate the problem more clearly I have increased the number Foo properties:public class Foo : ReactiveObject{ [Reactive] public int Bar { get; set; } [Reactive] public int Baz { get; set; }...

View Article

Answer by Sinatr for How to queue WhenAnyValue subscriber calls containing...

Using this answer I've made my own SybscribeAsync extension method with parameter:public static IDisposable SubscribeAsync<T>(this IObservable<T> source, Func<T, Task> func) =>...

View Article


How to queue WhenAnyValue subscriber calls containing asynchronous code?

What is the correct way to prevent subscribers to be called in parallel, before previous call is completed?I have kind of race condition atm with code like thisSomeReactive.WhenAnyValue(o =>...

View Article

How to avoid stale values when using WhenAnyValue and null propagation?

I need to monitor for changes of nullable Foo, including Foo = null or changes of any property like Foo.Bar = 123.So I am using this syntax (similar to recommended):WhenAnyValue(o => o.Foo, o =>...

View Article

Comment by Sinatr on How to stop Visual Studio from creating language...

Those dlls with language-specific resources are called satellite assemblies. You can try to search for topics with it in name, e.g. here is one.

View Article
Browsing all 350 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>