eid
eid
CC#
Created by eid on 6/30/2024 in #help
await in c#
i can't understand await in c#, can u explain it with short words
45 replies
CC#
Created by eid on 6/29/2024 in #help
svelte or react..... with asp net core??
i will start to learn js framwork, but i don't know which is better for me to learn with asp .net core , i'm thinking in svelte and react
5 replies
CC#
Created by eid on 6/25/2024 in #help
await-work in thread class is different from await-work in task class?
var thread = new Thread(async () => { Console.WriteLine($"Thread before await: {Thread.CurrentThread.ManagedThreadId}"); await Task.Delay(500); // Simulate asynchronous delay Console.WriteLine($"Thread after await: {Thread.CurrentThread.ManagedThreadId}"); }); thread.Start(); thread.Join(); // Wait for the thread to complete // Using Task Task.Run(async () => { Console.WriteLine($"Task before await: {Thread.CurrentThread.ManagedThreadId}"); await Task.Delay(500); // Simulate asynchronous delay Console.WriteLine($"Task after await: {Thread.CurrentThread.ManagedThreadId}"); }).Wait(); // Wait for the task to complete
4 replies
CC#
Created by eid on 6/21/2024 in #help
✅ CancellationTokenSource .. apply what design pattern?
i notice it's object wrap other object(cancellation-token),to prevent it to set its flag in the background threads,and it is the responsible for manage it(cancel it by set it true,callback method,timeout method,etc), what the name of that design in c#?
2 replies
CC#
Created by eid on 6/20/2024 in #help
✅ what is the name of the pattern that used in types that end with *source?
CancellationTokenSource,TaskCompletionSource,DataSource,EventSource
27 replies
CC#
Created by eid on 6/18/2024 in #help
svelte with asp.net core
I don't know why svelte not popular with asp.net core, i see it very easy and similar to blazor and overcome on the problem of blazor, i can't find book that talk about svelte with asp.net core , if u know a book that talk about that , please tell me about it
37 replies
CC#
Created by eid on 3/16/2024 in #help
Application.DoEvents method in winform, can't understand it, any one can explain it?
This deadlock, in its general form – UI waiting for something that is waiting for UI – has existed ever since we started making UI applications; it predates async-await, it predates .net and C#, it even predates asynchronous IO in the Windows operating system. And so, unsurprisingly, there is a standard solution for this problem already built into WinForms (and WPF and all other UI frameworks I know about). This solution is to let the UI handle events (or “pump messages” in Windows API terminology) while we are waiting for the background task to complete. In WinForms, we do this by calling the Application.DoEvents method. private void button1_Click(object sender, EventArgs ea) { var task = DoSomething(); while(!task.IsCompleted)#A Application.DoEvents();#A label1.Text = task.Result; } private async Task<string> DoSomething() { await Task.Delay(500) return "done";
20 replies
CC#
Created by eid on 12/19/2023 in #help
interface vs extension method vs method in class
what is better? to have a method directly in type or make the type implement it from interface or make the type have it by extension method?
8 replies
CC#
Created by eid on 12/19/2023 in #help
can any one explain that?
Why is functor not an interface? If both Option and IEnumerable support the Map operation, why are we not capturing this with an interface? Indeed, it would be nice to do so, but unfortunately, it’s not possible in C#. To illustrate why, let’s try to define such an interface: interface Functor<F<>, T> { F<R> Map<R>(Func<T, R> f); } public struct Option<T> : Functor<Option, T> { public Option<R> Map<R>(Func<T, R> f) => // ... } This doesn’t compile: we can’t use F<> as a type variable because unlike T, it doesn’t indicate a type but rather a kind: a type that’s, in turn, parameterized with a generic type. And it’s not enough for Map to return a Functor. It must return a functor of the same kind as the current instance
6 replies
CC#
Created by eid on 12/4/2023 in #help
decorator pattern vs adapter pattern
why i make the decorated class implement the same interface of the decorator ,while i don't make the adaptee class implement the same inteface of the adapter?
3 replies
CC#
Created by eid on 12/1/2023 in #help
i'm learning the functional programming with c#, i'm trying to use :validation<Exceptional<double>>
any one know about that type which it is alternative to either type. my question how to use that type, that is my trial , the invalid part is confusing with me. Validation<Exceptional<double>> calc3(double x, double y)=>y==0?Invalid(new Error("please use num less that 10")):Valid(Exceptional(x/y));
6 replies
CC#
Created by eid on 10/24/2023 in #help
❔ solid principles training
I'm studying solid principles using c#, i want to train on it, there is exercise or problem solving sites for that?? and what is the best way to train on it?
7 replies
CC#
Created by eid on 10/5/2023 in #help
❔ blazor .net8 vs angular
why .net developers insist on angular in it's job,, the track of learning .net plus angular is long,why they haven't used blazor instead until now?
10 replies
CC#
Created by eid on 10/3/2023 in #help
❔ How i can solve that in entityframworkcore
Unhandled exception. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Employees_Departments_DepartmentID". The conflict occurred in database "secondbase", table "dbo.Departments", column 'DepartmentID'.
14 replies
CC#
Created by eid on 10/3/2023 in #help
❔ ER diagram in azurestudio
i'm using linux , i tried azurestudio , but i can't find ER diagram in it, there is option?
2 replies
CC#
Created by eid on 10/3/2023 in #help
❔ Using Azure Data Studio instead ofSQL Server Management Studio (SSMS)
I'm using linux , and SSMS not provide in linux, can i learn SQL Server using Azure studio?? If yes, there is tutorial (books, documents)for that?
4 replies
CC#
Created by eid on 10/3/2023 in #help
✅ dotnet ef scaffold problem
dotnet ef dbcontext scaffold problem dotnet ef dbcontext scaffold 'Server=localhost;Database=secondbase;User Id=sa;Password=rereouiuf111!;Encrypt=True;' Microsoft.EntityFrameworkCore.SqlServer Build started... Build succeeded. connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
4 replies
CC#
Created by eid on 9/21/2023 in #help
❔ EF Core Power Tools for vscode
i'm using linux , so i can't use vs community on it, so i'm using vscode, now i'm learning ef core, i need to do database first approach(covert database to model code) , i found there is gui way to do that by that extension(ef core power tools) but that available for vs community, my question there is gui extension in vscode can do that, or there is any gui tool or program do that in linux??
4 replies
CC#
Created by eid on 9/19/2023 in #help
✅ dotnet add reference in vscode
there is gui way to add reference in vscode instead of run command or type , i mean like vs community does, just r click and choice add referenceee ?
9 replies
CC#
Created by eid on 9/15/2023 in #help
✅ databases name in sqlserver extension in vscode
No description
14 replies