« first day (3419 days earlier)      last day (1528 days later) » 

4:00 PM
@Wietlol I'm getting somewhere
So what delegate instance does int(b) => {} return?
 
nothing
 
I wish I could offline most of this code, they refuse to get a new system, even though Microsoft themselves say its now unsupported
 
\o
bye
 
o/ til next time Hans
 
obye
 
4:03 PM
@Wietlol Action a = int(b) => {}; is wrong because Action is a parameterless and return type-less delegate instance, so how can this statement be fixed?
 
the type Action accepts some generic types
Action<Int32> has 1 parameter of type Int32 (or int)
Action<String, Boolean> has 2 parameters of type String (strnig) and Boolean (bool)
etc
also, the syntax is (int b) => {}
iirc, int(b) => {} is like how C does function signatures
but that would be weird since then the int is the return type but the lambda has no return value
but whatever...
 
Also I see now that the first argument in Task.Factory.StartNew(() => {}, TaskCreationOptions.LongRunning) is the delegate instance Action which is passed to the method StartNew(). So @Wietlol the only way to pass a method as a parameter to another method is to assign that method to a delegate and pass the delegate as an argument to a method?
 
not necessarily to a delegate
just an Action or Func is sufficient
delegates in C#, despite what anyone will tell you, are just type aliases for functions
StartNew takes an Action
 
53 secs ago, by Wietlol
delegates in C#, despite what anyone will tell you, are just type aliases for functions
Haha greate one liner:
What is a one liner for a Func then?
 
Func<Int32> answer = () => 42;
 
4:11 PM
Is Func exactly the same as a delegate?
 
yep
a delegate is like this
 
i.e. type aliases for functions
So why have both if they are the same?
 
delegate Boolean Filter(String s);
 
which is better to use?
 
then, you can say "hey, this method needs a string filter as argument"
so, you do public void DoTheThing(Filter myFilter)
"Filter" effectively just becomes a type alias for Func<String, Boolean>
if you did public void DoTheThing(Func<String, Boolean> myFilter) you would end up with exactly the same code
 
4:13 PM
brb
 
just a different way of writing it
I would say go with Func and Action by default
when you feel like an alias would be a lot more readable, then make a delegate
(delegates are older than Action and Func tho, so older code (examples) may use them for not any real reason)
the technicalities are a bit more difficult, but basically everyone treats delegates as aliases for Action and Func nowadays
 
Sorry but I dont understand:
4 mins ago, by Wietlol
so, you do public void DoTheThing(Filter myFilter)
 
what do you not understand?
 
This:
6 mins ago, by Wietlol
delegate Boolean Filter(String s);
To this:
4 mins ago, by Wietlol
if you did public void DoTheThing(Func<String, Boolean> myFilter) you would end up with exactly the same code
delegate Boolean Filter(String s);
 
if you have that delegate, you just make an alias for that type
Func<String, Boolean> filter = s => s.Length > 5;
for example, this "filter" makes a distinction between strings of length > 5 and length <= 5
(I have no clue why you would use it, but ok)
Filter filter = s => s.Length > 5;
that, is exactly the same
 
4:22 PM
Filter myDelegate = new Filter(/*pass method of the same parameter list and return type*/);
 
you dont have to use new here
just a lambda is sufficient
ironically, the constructor of Filter takes 1 argument... a Filter
so you cant really use the constructor
you need another way of creating the instance
 
Why doesn't the constructor of Filter take a string?
 
because Filter is basically like this
 
since delegate Boolean Filter(String s); has a string parameter
 
public abstract class Filter
{
    public abstract Boolean Invoke(String s);
}
 
4:25 PM
I have not seen the abstract keyword before.
Sorry but I'm being thrown a million things at once
 
public interface Filter
{
    Boolean Invoke(String s);
}
 
That's not a good way to learn
 
are you familiar with interfaces?
 
@Wietlol I will cover interfaces in one or two weeks
So I'm not there yet.
 
hmm... I guess it is not time yet to do delegates and lambdas yet then
 
4:28 PM
Does knowing delegates and lambdas build on interfaces and abstract?
 
not necessarily, but they do help a lot
in simple terms, you want to pass functions around
 
But from the sound of interface I can reason that it represents somekind of interface between classes and abstract must mean a class that does not exist
1 min ago, by Wietlol
in simple terms, you want to pass functions around
 
abstract class means that the class is still missing some implementation
 
Yes and I know that's what you need delegates for
 
interfaces are types that "technically" do not have any implementation at all
but sooner or later MS will break and interfaces will properly have implementation as well
 
4:31 PM
When you say implementation do you mean the body i.e. { }
 
yep
 
What is MS?
 
MicroSoft
(the creator of C#)
 
How can you declare a return type in a lambda expression?
Action a = (int b) => {};
Does => in (int b) => {} map the function signature () to the function body {}?
I'll be back
 
you just use Func<Int32> = () => 42;
the return value in your lambda defines what return type it has
 
5:17 PM
oooo its all kicking off in the Sales Dept!
 
if Func<int32> = () => 42 declares the return type as int32 then how do you call this function?
 
5:33 PM
I am on a windows machine. Wanting to create a .net core api project with Docker support that is deployed to Google Cloud Platform (Linux?). When the project is created what type of support should be enabled for Docker (Windows or Linux?)
 
V.7
5:43 PM
Oh dear ...
VBA is so bad ...
It's so f*cking bad ...
 
@JoJo No idea, but if I were a betting man I'd stick my money on nix
But again, I have no idea
 
Do people still use VB for Applications and why? is that like from the early 90's?
 
@JoJo still fix update vb6 code
No one is making a NEW app in vb6
unless they old and dumb
 
that makes sense
 
or a dll is locked to something
that is most common
can't update b/c some dll that is used to build isn't compatible going forward off xp
 
5:50 PM
is that where an adapter or facade pattern could be used in a new project to avoid coding in VB though?
opens can of worms...
 
Teresa Dietrich on February 25, 2020
As we work to improve our relationship and communications with our users, we want to share with you our community roadmap each quarter, so once every three months. Even though we are halfway through this quarter, we wanted to share with you what we are working on currently. In March, we will share our roadmap…
 
interloper is more likely
ya facade pattern is correct
didn't know it had a patter name lol
 
yeah, just thinking of ways to get the job done while killing the old tech :) I don't have a lot of experience with it though.
But if I ever saw VBA again, I would be getting very inventive for my boss :)
 
Ah, sounds like you have the same project as me atm lol
Porting over a load of crap written in VB
My favourite part so far, they wrote their own CSVParser....
 
V.7
@JoJo For Excel macros currently
It's stated by customer
 
5:57 PM
And I had to import the Microsoft.VisualBasic.FileIO namespace into my code to use the one built into VB that they somehow completely missed...
 
missing refs happen
 
6:37 PM
@MyWrathAcademia you are missing a name
Func<int32> theAnswer = () => 42
then you can do theAnswer.Invoke() or theAnswer() for short
 
@Wietlol thanks
What is the output?
I'm wondering if a lambda expression only returns a value if you explicitly use a return statement?
E.g.: Func<int32> theAnswer = () => {return 42;}
Does theAnswer()output 42?
Is the following right:
If we want one parameter in a lambda function we do Action result = () => {};
If we want two parameters we do Action<int, int> result2 = (int a, int b) => {};
if we want three parameters in a lambda expression then we do Action<int, int, int> result = (int a, int b, int c) => {};
@Wietlol Yes or No?
 
6:57 PM
() => {return 42;} and () => 42 are identical
just syntax sugar
your parameters look fine, yes
 
7:12 PM
I have a dictionary that I'm trying to replace with an indexer. Thing is, at one point I'm using SelectMany() and I'm not sure how to expose that functionality.
 
7:27 PM
@Wietlol thanks. Are the only two types of delegates in C# Action and Func?
 
you can make your own
but those two are the most common
 
Why would you need to make your own delegate when there is Action and Func?
And what are the uses of a delegate. Is it needed for only when you need to pass a function as a parameter?
When else is a delegate needed in C#?
 
It can be useful to make your own delegate if your delegate is starting to get complicated.
 
@JonathonChase like how? Please give a code example?
I have to go.
@Wietlol great chat. I'll be back tomorrow.
@Wietlol See ya later.
And you too @JonathonChase
 
@MyWrathAcademia naming
for Func<String, Boolean> it wont matter a lot
but if you have a type of 200 chars long, you kind of want an alias
 
7:39 PM
58 secs ago, by Wietlol
but if you have a type of 200 chars long, you kind of want an alias
Please give a code example
 
Evening all
Gordon Bennet Wiet, you're still here?
 
Func<String, String, Int32, Dictionary<String, List<Object>>>
(not 200, but still long)
 
Also, recursive delegates.
 
posted on February 25, 2020 by jonskeet

So, just to recap, I’m writing an explorer for my Roland V-Drums set (currently a TD-17, but with a TD-27 upgrade on the way, excitingly). This involves copying configuration data from the module (the main bit of electronics involved) into the application, displaying with it, editing it, then copying it back again so that I … Continue reading V-Drum Explorer: Memory and 7-bit addres

 
also, that
 
7:42 PM
So I'm gonna show my lack of C# knowledge here, when should I use a Dictionary over just a plain old list?
 
Dictionary is Key Value, List is ordered values
 
So a dictionary isn't ordered by itself but would be fast to search through?
faster*
 
It's constant time lookup by key
No speed improvement if you're iterating.
 
yeh kinda guessed that
but always nice to be confirmed :D
Ive never used a hashtable either, what's the main advantage there?
 
Hashtable is a non-generic dictionary
 
7:46 PM
non-generic?
 
I wouldn't use it in modern code.
 
gotcha
 
Yeah, it takes object as a key and object as a value and returns object for either
 
saves some space on my brain
 
so you lose the type safety that a generic can provide.
 
7:47 PM
oooooooo non-generic! now i get it lol
thanks for that, always nice to have someone explain this stuff when all you have is textbooks
sometimes can't see the wood for the trees y'know?
if that's the phrase :/
 
forest for the trees might be more idiomatic? I get what you're saying either way
 
sounds about right
right cya tomorrow probably have a good one
o/
and thanks again
 
 
1 hour later…
8:53 PM
If I want to iterate through a list of objects, but the loop itself can add more items to the end of the list, what's the best way to go about that? It's not possible to add items indefinitely.
I keep getting an " 'Collection was modified; enumeration operation may not execute.'" error
 
a for loop
where you only ref the index, that's also takes into account you don't change the end index from when you started the loop
or don't need to read past it
 
can you give me an example?
 
queue
create a queue from your items, then iterate over them with a while loop
or you separate the logic of appending from the logic of iteration
 
var list = GetInitialList();
for(int i = 0;i<list.Count;i++)
  if(list[i]%2 == 0) list.Add(1);
@Hypersapien Like that
You iterate without using an enumerator or iterator, but just by counting up a number
And the list is non the wiser
So it can't complain about being enumerated and manipulated at the same time
 
9:16 PM
There ya go like squirrelkiller
sorry trying to meet a deadline
 
Okay, got a career question in the .NET space. My experience is mostly in application support ~3 years. For the last year I have been a Software Dev. But a recruiter reached out about a Support .NET Developer role. Is that a step backwards? The pay is much higher, but I fear it will hurt my career in the long run.
 
Well, what does a support developer do
 
Work closely with other developers and in-house subject matter experts to thoroughly understand the product features and the code behind them.
Maintain and improve the established product by implementing minor enhancements and fixing defects that range from minor aesthetic issues to hard to reproduce defects.
Participate in a SCRUM based SDLC and provide feedback that helps improve the process.
Assume ownership of the support ticket queue.
Participate in building out the team’s dev ops to be state of the art and incorporate support.
 
>Assume ownership of the support ticket queue.
 
That was 100% the line that has me not wanting to keep talking with them.
It is at a smaller company, like ~50 people. Currently all of my work as been at companies that are huge like 20k plus
So no clue how that impacts things
 
9:29 PM
So it sounds like you're gonna be the person they have do all the grunt work
setting up and maintaining their builds
fixing bugs they can't or won't
 
and possibly answering the phone from users
which would be a hard no for me
 
"dev ops" is code for "we're gonna have you maintain servers, too", probably
 
@JonathonChase Same, been there done that
I feel like the job itself with my support experience I would be good at. The salary bump would be awesome. But I want to be a software dev in the long run.
 
9:45 PM
So, the upside is the money and you think you'd be good at the job.
The bad news is that I think it's very likely that this job is gonna try to take advantage of you. Either by dumping work on you that the more senior devs don't want to do or making you do devops work or, worse, expecting you to be on call.
 
Great points. Fun thing is Im on call already like twice a year at my current role. But thats what ever. Would a dev team in the future see a role of 'Support .NET Dev' as not a software developer? I dont want to get stuck in a rut basically
 
I dunno, it's got developer in the title, doesn't it
When I read "Support .NET Developer", I assume it's a technical role, albeit not a particularly senior one.
 
Very true, but on the senior note. Im not a senior yet. But would like to get to that point :D
 
10:04 PM
So, yeah, if you think you can do the job and you'd be good at it, I wouldn't be so worried about the title.
 
10:42 PM
I'm trying to do a Reflection clone of a EF object, but GetFields isn't picking up any of the fields. I think it might have something to do with the BindingFlags. I'm using Public and Instance. Is there something else I need?
 
mr5
you guys are early
 
I'm late
 
Can you show an example of one of the fields' implementation?
 
Hmm?
 
how are one of the fields you're trying to get defined in code?
 
10:45 PM
It's an Entity Framework object. The code is generated. I'm looking at it at now and it doesn't look out of the ordinary other than being a partial class. one of the properties is public string AccountCode { get; set; }
 
Have you tried using GetProperties instead of GetFields?
 
Trying it now
Still nothing
 
You might want to try FlattenHierarchy. This includes all the inherited members. It could be the class you're doing the reflection inherits the properties/fields you care about.
 
Ok, maybe I'm doing this wrong. I just tried the same method in the Watch on one of my own classes defined on that page and I still got nothing.
Fuck. Stupid copied SO code
GetProperties(), not GetFields().
 
11:01 PM
PropertyInfo[] props = typeof(SomeClass).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
 
So GetProperties worked?
 
Yeah
One thing though, it's also picking up properties for FK tables
 

« first day (3419 days earlier)      last day (1528 days later) »