|
Did you know there are Deconstructors in C#?
Did you know they were called that?
class Rectangle
{
public readonly float Width, Height;
public Rectangle (float width, float height)
{
Width = width;
Height = height;
}
public ~Rectangle(){
Console.WriteLine("In destructor...");
}
public void Deconstruct (out float width, out float height)
{
width = Width;
height = Height;
}
}
Here's a driver for the code:
var r = new Rectangle(15, 30);
var (width, height) = r;
Console.WriteLine($"{width} : {height}");
If you don't have the deconstructor in your class and you try the destructuring you will get an error like:
C# Compiler: (1,6): error CS8130: Cannot infer the type of implicitly-typed │
│ deconstruction variable 'width'.
And, here is an example of Destructuring in JavaScript...
const person = {
firstName: "John",
lastName: "Doe",
age: 50
};
let {firstName, lastName} = person;
console.log(firstName);
consol.log(lastName);
FYI - The Rectangle example with the Deconstructor is from chapter 3 of
C# 12 in a Nutshell: The Definitive Reference[^] which I'm reading right now.
Hello, Software-Dev-Terms, could you be any more confusing? Could you, though?
Maybe add in the word Destructurizification. ![Roll eyes | :rolleyes:](https://www.codeproject.com/script/Forums/Images/smiley_rolleyes.gif)
modified 6hrs 5mins ago.
|
|
|
|
|
never had an opportunity to develop in C#, but I'm not dead yet.
In the past, I seem to recall that one of the "C# is better than C or C++" is automatic deconstruction or memory management. What did I miss?
Charlie Gilley
“Microsoft is the virus..."
"the problem with socialism is that eventually you run out of other people's money"
|
|
|
|
|
raddevus wrote: Did you know there are Deconstructors in C#?
Yes, ever since I read the first spec back in 1999.
Never had a use for one though.
|
|
|
|
|
|
|
|
Apple or low budget, choose one
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
The shortest horror story: On Error Resume Next
|
|
|
|
|
That's cool.
The iPhone support RAW video, so they can tweak and color correct in post-prod.
I assume they did test runs and it works for their workflow.
Remember that most movies have very short cuts, there is no problem with overheating or storage or draining the batteries too much.
I see no issues with that.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
There is no problem with the quality of the video, the iPhone has a good reputation, but compared to video camera's with a lens mount the choice of lenses is very limiting I think.
But as the saying goes:
Quote: in the limitation the master shows himself ![Shucks | :-\](https://www.codeproject.com/script/Forums/Images/smiley_shucks.gif)
|
|
|
|
|
of course.
I assume they use different cameras for specific shots.
but if it works for them ...
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Adding some cooling and keeping the phones charged with a battery pack is doable anyway. I like this kind of experimentations, they are really an artistic expression of the highest magnitude.
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
The shortest horror story: On Error Resume Next
|
|
|
|
|
|
there was indian section on cp, idk where it is @Moderators
=====================================================
The grass is always greener on the other side of the fence
|
|
|
|
|
Nitin S wrote: there was indian section on cp It was closed down years ago, if I remember correctly. This remains an English language site.
|
|
|
|
|
GitHub - sammycage/plutovg: Tiny 2D vector graphics library in C[^]
It's sparsely documented, and difficult to follow at first until you understand the patterns the author employs.
That being said, it's a neat bit of kit. It allows full SVG capabilities (minus the XML part) and unlike my previous offering it actually appears to render as you add items to the canvas, rather than forcing you to build the entire graphic and then pass that to the rasterizer. That in itself is really interesting.
What's also fun about it, is it uses the vestiges of a TrueType font rendering engine called FreeType to do the rasterization. It has been modified to do color paths.
But it doesn't use FreeType to support text. It uses a different engine by STB - the same one I use in my library, which is a boon to me, because I've already made a compatible port for embedded that drops in.
Anyway, it appears to be fairly unique in terms of how it operates - especially with the immediate rendering.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
|
Pretty weird, the guitar thingy is pretty cool but equally as weird.
A home without books is a body without soul. Marcus Tullius Cicero
PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com
Latest Article: EventAggregator
|
|
|
|
|
The Commodore 64 was already weird, but things can get even weirder !
![Laugh | :laugh:](https://www.codeproject.com/script/Forums/Images/smiley_laugh.gif)
|
|
|
|
|
I bought one back in the early/mid? 80s, had a lot of fun with it.
A home without books is a body without soul. Marcus Tullius Cicero
PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com
Latest Article: EventAggregator
|
|
|
|
|
I'm sooo confused.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
This should go in Insider News!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Here's the question I needed answered (and couldn't seem to find a good answer on StackOverflow):
I asked Copilot Can you show me how to copy a file from my local file system into the docker container using bash?
Copilot said Sure! You can use the docker cp command to copy a file from your local file system into a Docker container. Here’s how you can do it:
Basic Syntax:
docker cp <local_file_path> <container_name>:<container_destination_path>
Example: Let’s say you have a file named example.txt in your current directory that you want to copy to the /app directory inside a container named my_container:
docker cp example.txt my_container:/app/example.txt
Verify the File: You can then verify that the file has been copied by listing the files in the destination directory inside the container:
docker exec my_container ls /app
That's a good one!
Now I know how to interact with files _inside_ my Docker container from _outside_ (from local file system) my docker container.
Copilot is my friend. I've never been able to say that of anyone on SO.
Only, sometimes, could I say "well they didn't entirely abuse me." ![Laugh | :laugh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_laugh.gif)
|
|
|
|
|
raddevus wrote: well they didn't entirely abuse me.
You obviously weren't trying hard enough!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Whew, I got out of the computer support biz just in time. First crowdstrike, now this.
All we ever had to deal with was the old intel floating point debacle.
|
|
|
|