« first day (2748 days earlier)      last day (2217 days later) » 
02:00 - 12:0012:00 - 00:00

12:00 PM
MakeGenericType will turn a List<> to a List<string>.
@TusharTyagi In that case, generics aren't the right fit. This is exactly what the non-generic Type-receiving overload is for.
 
@AvnerShahar-Kashtan Yeah, I finally learned that, haha.
That was my next question though. Generally, in such situations it's much better to go with Type-receiving oveloads
Cool, thanks
 
ahoy mateys o/
 
Much better than working with reflection to go from the string "IStorageConnector" to the type IStorageConnector, and join it with typeof(ConnectorFactory).GetMethod("GetConnector").MakeGenericType(connectorTyp‌​e) and call that. That's more fragile, probably slower, and harder to read.
 
Has anyone ever sent emails through code via an exchange server before?
 
12:08 PM
What kind of exchange server? Like, bartering. Send an email in exchange for a goat?
 
microsoft exchange server
 
Oh, the boring kind.
 
Having a strange issue with the request occasionally not sending the auth credentials when it sends the request
yes unfortunately
 
@CaptainSquirrel Sure.
There are about half a dozen ways to connect programmatically to an exchange server. Which are you using?
 
System.Net.Mail.SmtpClient
 
12:10 PM
Hmm. Never ran into a problem there.
 
We use the same code to send our emails
It does the EHLO & AUTH LOGIN commands however it doesn't authenticate as the user
 
Hi guys
 
This also doesn't happen all the time
It sends successfully more than it fails
 
Is there a way to add Url.Action("actionmethod", "controller") in a class that isn't a controller in NetCore?
 
@gbade_ Url.Action redirects to a controller method, right? This only makes sense in a controller, because the controller's method is the one that returns the HTTP response that results in the redirect to the controller's actionmethod.
If you call it in a random method somewhere, what would you expect it to do? It doesn't know what HTTP request you're a part of it. It has no way to return to the client and redirect it.
Or does Url.Action simply build the string?
If so, UrlHelper.Action might be what you need.
Or is that not in .NET Core?
Oh, nevermind. I never used MVC anyway, core or otherwise. I'm just guessing.
 
12:20 PM
You did a good job guessing Avner.
 
user9145305
Is there a way to convert group.Groups from an ObservableCollection to an IEnumerable here? I thought it would do it automatically: return Group.Traverse(this.Scenario.TopLevelGroup, group => group.Groups).OfType<GroupDecision>().FirstOrDefault(c => c.Decisions.Any(d => d == Source));
 
OBservableCollection is IEnumerable.
 
user9145305
Is there a way to cast in Lambda expressions? Can I throw a cast in the group => group.Groups ?
 
Cast what?
What do you mean "throw a cast"?
In other words, you're probably misunderstanding the error message, which you haven't even told us what it is.
Because there's no cast needed to treat ObservableCollection<T> as IEnumerable<T>.
 
user9145305
I see. I figured so. So the problem is the abstract class Group holds a static Traverse method. But this.Scenario.TopLevelGroup is of type GroupGroup, but that class implements Group but I cannot implicity cast a Group to a GroupGroup
 
12:35 PM
@AvnerShahar-Kashtan Url.Action generates a URL with a provided Controller name and actionmethod name
 
@Cuphead That's because a Group isn't a GroupGroup - it's a GroupGroup that's a Group.
 
user9145305
So throw the traverse method in the GroupGroup class?
 
But you can use Cast<GroupGroup>() to turn an IEnuemrable<Group> to an IEnumerable<GroupGroup> - assuming, of course, they're all GroupGroups.
No, I don't feel silly at all.
A static method that accepts IEnumerable<Group> should work fine on an IEnumerable<GroupGroup> - IEnumerable<T> is contravariant.
 
@AvnerShahar-Kashtan I intended generating a URL with a specific controller name and action name
 
(Or covariant, I always froget which is which)
 
user9145305
12:38 PM
What happens if they're not all GroupGroups lol
 
Exception.
But I still don't understand what you're trying to do, or what Traverse does.
 
user9145305
grr
 
It flattens a tree?
 
When you flatten a tree you should have some logs afterwards.
 
It gets an IEnumerable<Group>, a lambda that does group => IEnumerable<Group, and recurses inwards?
 
user9145305
12:40 PM
Yeah, this was the question I asked. I don't know why I received a -1, but: stackoverflow.com/questions/50005909/…
 
user9145305
Taking Sevy's suggestion
 
Yeah, that's a standard tree flattener. Right.
Break down your expression. First, Traverse takes your root and creates a flat IEnumerable<T>. Separate it to a separate statement. Does it return what it's supposed to?
Assuming your root is a Group and its Groups property is of type IEnumerable<Group>, then it shuld return an IEnumerable<Group>.
If the problem is with the generic type inference, where T is assumed to be of type GroupGroup, but GroupGroup.Groups is of type IEnumerable<Group>, then you need to override the default type inference.
Either cast TopLevelGroup to Group so the compiler will infer its type as Group, o specify it in the Traverse call as Traverse<Group>(TopLevelGroup, t => t.Groups).
 
@nothl I fixed it with this:
    System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

    config.AppSettings.Settings.Add("MaximumLoadEntries", "5000");
    config.Save(saveMode: ConfigurationSaveMode.Full, forceSaveAll: true);
It only works for the test, and doesn't add BS to the actual project, so it's purrfect
Now I just need to fix it so it stops adding the value on every run, and I'm golden.
 
@AvnerShahar-Kashtan
I used IUrlHelper but was getting a null exception, that the helper was null
private static IUrlHelper _urlHelper;
public MakePayment(IUrlHelper urlHelper)
{
   _urlHelper = urlHelper;
}
public string PayTransaction()
{
   Transfer req = new Transfer
   {
      URL = _urlHelper.Action("Callback", "Order"),
      Ref = GetUniqueKey(19)
   }
}
 
user9145305
12:58 PM
Is there a different way to do this? I can't seem to figure this out.
 
Is there something like [DebuggerStepthrough] for blocks of code?
 
Is anyone familiar with Unity containers?
 
Like, I don't need to go over all these input checks each time I debug my input.
 
@Squirrelkiller Breakpoint conditions?
they will only break if the condition you need is met.
E.g. when looping through a list of key-value pairs you can tell the breakpoint to break only when the value is a number.
so you put the breakpoint in the middle and only check numbers.
Or a specific number.
You get the idea.
 
I meant more like something to skip a specific block when going through with F10
 
1:03 PM
@HéctorÁlvarez What about them?
@Squirrelkiller Extract them to methods and add [DebuggerStepThrough]?
Or alternately, simply place the breakpoint after them and Run.
Or just do Run To Cursor ad-hoc to skip them.
 
Yeah probably doing a breakpoint again :/
extraction wo...might actually work. Gonna look at that. Gotta route the returns.
 
Hello, what do you think about the future of WPF? Should I keep developing desktop apps using WPF or is it better to switch to something different?
 
This is a direction we don't hear so often
WPF rocks, will probably have many good years left. Depending on what you want to do, Web might be more...modern.
 
But I'm definitely going with WPF
 
1:10 PM
Anybody here who have used sqlbulk copy?
 
user9145305
Casting to a Group did not work. Group doesn't have a property of type Groups, only GroupGroup does.
 
1:35 PM
hey if my library has a direct dependency on Newtonsoft.Json 11 and a transitive dependency on Newtonsoft.Json >=10, why do I get System.IO.FileLoadException : Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0?
 
are those dependencies in the same project?
 
@Cuphead And Groups is of type IEnumerable<Group>?
 
i think this usually happens when there isn't found any version of NJson and it tries to load the minimum version
 
So it seems like you'll have to use OfType<GroupGroup> to filter your gg.Groups to only return those of type GroupGroup.
 
1:37 PM
my project file contains:

<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.1" /> <!-- depends on Newtonsoft.Json (>= 10.0.1) -->
shouldn't that just work without binding redirects?
 
user9145305
Groups is a ObservableCollection<Group> so yeah.
 
<dependentAssembly>
  <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
That's my dependency for Newtonsoft.Json.
 
but I don't want 10, I want version 11
 
Then fix it to 11? :P
 
yeah but why do I need to add a binding redirect if the package has a version range of >= 10
 
1:41 PM
I dunno, I just know binding redirects solves all my problems always.
 
@HéctorÁlvarez Oh. Once I went down on that rabbit hole. Tho that was inserting one column if it didn't existed in the database. One of the problems were only 1 person had that right to modify table. Only that person had a version, which didn't exit.
 
@AvnerShahar-Kashtan I have a property tagged as [Dependency] and it's properly registered (I assume) with the following code:
container.RegisterTypes(
                AllClasses.FromLoadedAssemblies().Where(
                    t => t.Namespace == "TheNamespace.Models"),
                WithMappings.FromMatchingInterface,
                WithName.Default,
                WithLifetime.ContainerControlled);
So the property goes as follows:
        private FooDAL _FooDAL = new FooDAL();

        [Dependency]
        protected FooDAL fooDAL { get => _FooDAL; set => _FooDAL = value; }
 
are there alternatives to Newtonsoft throwing an exception on an invalid JSON parse?
 
@cubesnyc what alternative could there be?
 
When I run it, the fooDAL atribute and its property both return null.
 
1:45 PM
null value?
 
why would you even want that?
 
why would i want an exception?
 
something something Haskell
 
user9145305
@AvnerShahar-Kashtan Well I need to recursively access the GroupDecisions in the Groups to see if the Decisions List contains the passed string.
 
@cubesnyc why would you even want callbacks?
 
1:50 PM
@cubesnyc Because the data is malformed and continuing on with it might spread the data corruption to the rest of your system?
But yeah, there are ways to tell JSON.NET to not throw on certain types of errors.
@Cuphead So yeah, it gets messy, because your inheritance tree is messy. It would be better if Groups existed on the parent Group, but always returned an empty list for all groups except GroupGroups.
Right now, you're forcing your code to break polymorphic encapsulation. You have to know what specific type you're dealing with.
 
user9145305
Is there a different approach to this?
 
GroupDecision is a type of Group, right?
 
user9145305
Yah
 
user9145305
My original method was workable, it just needed to be recursive.
 
@AvnerShahar-Kashtan well there is already functionality that if a key doesnt exist in the jobject it will return null, so why not extend that functionality even if it is malformed, or at the very least return null.
 
1:56 PM
public IEnumerable<string> GetDecisions(Group root)
{
  if (group is GroupDecision gd)
  {
     yield return gd.FirstOrDefault(gd => gd.Decision);
  }
  if (group is GroupGroup gg)
  {
      foreach (var subgroup in gg.Groups)
      {
           foreach (var decision in GetDecisions(subgroup))
           {
                yield return decision;
           }
      }
   }
}
@cubesnyc Because that's a bad feature that will be constantly and consistently abused.
 
almost like tryXXX isnt a design pattern in .net
 
@cubesnyc You want JsonConvert.TryDeserialize() that simply returns null if it fails?
 
no jsonconvert requires a class right?
i am using jobject.pars
 
Whatever. Are you asking for returning null on parse fail, or on returning a partially populated JObject?
 
user9145305
I might not have been clear, I just want to return the GroupDecision Object that contains the passed in String in its Decision List.
 
2:03 PM
ideally it would just return a jobject shell that will return null when i try to access any field
point is i dont care if its malformed, id rather not waste resources handling it and just ignore it
 
@cubesnyc JObject is an object representation of a valid JSON structure. What you're talking about is the JObject of {}.
@cubesnyc You're simply asking to waste more resources later on. Don't care? Catch the exception and move on.
Don't return an apparently-valid object that, in practice, is useless.
 
i dont understand how you can make these claims
 
>If a property is optional or has an empty or null value, consider dropping the property from the JSON, unless there's a strong semantic reason for its existence.
 
@cubesnyc What, that an invalid JSON file shouldn't return a valid JObject object?
 
2:05 PM
if i have a messageprocessor(string) method that just deserializes the object and does something based on a field, id rather just do nothing on a malformed message than throw an exception and do nothing
 
@cubesnyc So you're not talking about malformed json, you're talking about json that doesn't match your expected format?
Basically, you want a JSON Schema validation.
 
no im just talking about any non conforming message
 
There's a difference between a JSON file that contains { blah blah }, and a json file that simply doesn't contain the data you want it to.
 
@cubesnyc Are you actually aware you can catch and handle exceptions?
 
if someone writes "ihavenoideahowtowritejsonmessages" i dont care i will just try and parse it, accessing json["field"] will return null and i move on
 
2:07 PM
So create own parser. Closed.
 
Anyway, I'm off to brave the hailstorm and get home now.
@cubesnyc Just do try { return JObject.Parse(blah); } catch { return new JObject();}, then.
I think it's a bad idea because you lose information, you can't differntiate between bad input and null input and a field that exists but has null value.
But go right ahead.
 
@AvnerShahar-Kashtan This is breaking JSON RCF and all styleguides
Its anti-pattern
 
that still doesnt solve the issue of overhead by throwing an exception i dont need
anyway i was just asking, doesnt seem like its possible
 
So better write own parser instead
 
~~overhead~~
 
2:14 PM
If you want go on easy road follow standards/patterns, but if you want well fitted solutions fight with god and write custom solutions. After that i propose to share it and make world better
Protip for all segments of IT
 
i mean from my perspective, if i query a field and it returns null, from my perspective it is just as exceptional as if the json was never able to parse at all
except in one scenario it throws, and in another one it doesnt
 
Am I having a stroke? Avner and J.Doe have the same opinion?
 
@cubesnyc If you have null then you should send error 404 not found
 
lads i need to ask you all the most important question in history
Oblivion or Morrowind?
 
Oblivion
 
2:18 PM
@cubesnyc An example. I have a db with people in it. I query my service for a Person from the db with a specific name.
You get an empty object back - there is no info on that person, or the db doesn't have that person.
You get back gibberish - the service is broken.

Definitely a difference.
 
yea theres a difference in your scenario
but what if you didnt own that service
so you didnt care if the service was broken
 
Then there is the difference of "Oh microsoft doesn't have my data" and "Oh microsoft has a bug there that needs fixing"
I do care. Because if I pay for something to use it, it better works.
If I put data into a database, and that data doesnt come back properly, someone needs paddlin'.
 
thats not an equivalent comparison
the equivalent comparison would be if you sent a query to a database, and the database didnt return anything unless you sent it a proper query
and in all other scenarios just returned a null object
 
The thing is, you need to know the difference between "its not there" and "freuiovwbg o"
 
@cubesnyc I would separate broken data from parsable valid JSON, and store the broken data for later migration with a custom parser.
 
2:22 PM
you dont think there is ever a scenario where a person might not care about the difference?
 
@ntohl Still anti-pattern, better send error
 
@cubesnyc Ignorance is never good
 
@cubesnyc I still dont get your problem
 
Ask J.Doe
 
I had a colleague who looked at a dataset, and made random assumptions, that data in a random column was so much null, it should be ignored, named Schiff XY. Later that colleague was called Shift XY, because most of his code needed shift delete to fix majority of his code...
@J.Doe Yeah. After warning the user 2000 of 20000 data is invalid. And User accepted that he/she want to continue anyway.
 
2:30 PM
@Squirrelkiller Knowledge is a road to improving yourself. Without knowledge we are just normal animals. Ignorance is opposite to knowledge
 
jup pretty much
 
ja
 
Do you know editor, where i can do graphs like this daveaglick.com/posts/images/blazor.png ?
 
@AvnerShahar-Kashtan try { return JObject.Parse(blah); } catch { logger.log("learn JSON you weeb"); return new JObject();}
Upgraded logic.
 
Upgraded logic with no logic.
 
2:34 PM
Lol, anyway it is a bad practise to ignore bad inputs. No problem for you, but whomever has to deal with your lack of expertise when it comes to warning about errors will think you are as poor as the concentration of bad ingredientes in mineral water.
Look at this idiot, can't even parse a JSON. Haha, I sent a fragment of Lorem Ipsum got 200 - OK back.
Along those lines.
 
that is the weirdest analogy i have ever read
 
Anyway, @Avner going back to Unity containers, do you have any ideas about what could be wrong? Because when it comes to this kind of frameworks I'm rather useless.
@Harry Yeah, I had a different one but didn't want to be banned.
 
@HéctorÁlvarez Don't be afraid, don't hold your free mind on a leash. Say what you want to say. Being banned isn't that scary as they describing. Be free man without any mindbreaks
 
user9145305
2:49 PM
My method seems to get the right data, but it keeps running recursively after it gets the data and then the end result is null. Is there a way to break a method if the return type is null?
 
@J.Doe LaTex
with tikz
@Cuphead throw new Exception("result is null");
 
user9145305
Wont that stop the application
 
shouldnt do, its usually unhandled exceptions that kill apps
 
you wanted to break the method and if you throw an exception it is broken
 
user9145305
I can't believe there isn't an easier way to figure this out.
 
2:59 PM
also if you want your to stop your method from running after it gathered the correct data you should do it from outside the method
 
user9145305
Not this particular part, the overall problem
 
what is your overall problem?
this may be an XY-Problem
 
user9145305
 
1288
Q: What is the XY problem?

GnomeWhat is the XY problem? When asking questions, how do I recognize when I'm falling into it? How do I avoid it? Return to FAQ index

and take a look at tree traversing
you have basically a tree structure with decisions as leafs and groups as nodes
 
user9145305
Yeah, basically. But I tried a recursive function but it runs too often.
 
3:05 PM
@Cuphead normally once you reach a result the result is passed back through the recursive calls, so you need some kind of condition for the recursive call
for example if (result == null) recursiveCall(...);
 
Hey all!
 
user9145305
yeah, still doesn't work, idk
 
@Cuphead can you give a code example of what you want to do?
(havent followed the conversation)
 
@Cuphead is this an Assignment?
 
user9145305
It's a personal project
 
3:13 PM
@SebastianL its a job interview ;)
 
You laugh but
Dec 6 '16 at 19:14, by ScottVMeyers
Can anyone help me? I have an hour to finish an exercise to get a job
 
user9145305
lol, dang
 
user9145305
not me
 
@MikeTheLiar i know it happens
I am waiting for Jon Skeet to make such a question on main SO
 
@Cuphead then redesign your GroupObjects, checking if an Object is a certain type is in most of the cases code smell, and not the small one, more like nuklear waste code smell
 
3:16 PM
@Wietlol maybe next 1st of April
 
user9145305
lol, dang, ok. Ty
 
you are familiar with Interfaces?
 
@Cuphead try implementing this method
public GroupDecision GetGroupWithText(Group group, string text)
{
	if (group is GroupGroup)
		// recurse with early return
	else if (group is GroupDecision)
		// return
	else
		// throw unsupported exception
}
the if/else chain can be replaced by inheritance
except if the classes you use are from 3rd party libraries
 
user9145305
thank you, ill give it a shot
 
hint, dont use Where, use Select
 
3:26 PM
@MikeTheLiar lol and he failed even with 5 people assisting him
 
user9145305
@Wietlol why use Select over Where
 
Hey guys, I don't know where to ask this and I don't know what to google for :P. So I beg your pardon if this is the wrong place, but I am writing this in C# so I thought I stop by.
 
@Cuphead because you want to Select the response of the GetGroupWithText on the GroupGroup
you dont want to filter
 
@BadSnowflake just ask
 
I have a Unity3D app on a phone and a WinForms App on obviously Windows. Now I want to send data from Windows to Android. Now the obvious thing to do, would be to ask the user for an IP. However, I want to avoid that. The correct thing would be to do a UDP broadcast to find the app running on the android device listening on a specific port, right?
 
3:32 PM
after you have done the select, you want to do a Filter on nulls and then a FirstOrDefault (which can be a single FirstOrDefault call with the filter as parameter)
your IDE (assuming its not shit) should tell you that
 
@BadSnowflake depending on the resources you have available
you maybe should use a relay server so no IP guessing or broadcasting is necessary
 
@SebastianL What do you mean by that? I am assuming of course that both devices are on the same home network, Android on WiFi and the Computer cabled or WiFi too.
I dont want to use a server, this is not a commercial project
 
i made the experience that it can be quiet difficult to get a windows computer talk to another device with udp broadcasts
oh okay ^^
then UDP Broadcasts is the right way
 
Thanks :)
 
but there are some issues that can come up:
your router may be blocking WiFi devices from talking to LAN devices
 
3:35 PM
Yeah, WiFi isolation
 
and you need to send The Broadcast from the right NIC installed on your PC
 
I'd assume there would be only one on most home pc's
 
since there can be multiple NetworkInterfaceCards (virtual or physical)
 
Well, some may have a wifi stick and a network card from the mobo
 
just look at the device manager
there should be listed all of them
 
3:38 PM
Yeah, can get complicated, but I really want to offer an automatic way
I can add an IP field for a manual IP in the options
 
if something like a VPN, VirtualMachine Host, LAN bridge or some other network dependand app is installed they all add their own virtual NIC
 
you can, you just should know why it could fail, because exactly this NIC thingy drove me crazy a few years ago
 
Yep :D
I really appreciate it :). Just trying to make a small app with a desktop companion, basically for myself and I probably upload it somewhere for the shits and giggles, but thats it.
 
Linux is much easier with this topic :D
(android counts as Linux)
 
3:42 PM
Yet, it can't mount a network folder :P (sorry had to)
This drove me crazy when I got an android phone the first time and I had to buy an app for that
 
:D
i use ES File Explorer for that
 
I use File Explorer+. It's neat and does what I want. But I dont want to promote anything in here... the mods are watching.
 
this is just the chat, the rules aren't that strict here
 
4:00 PM
Last time I tried to use ES it was full of nasty shit
 
 
@J.Doe I can be a free man without being an asshole. Freedom doesn't mean entitlement.
Actually, freedom is usually acknowledged when you are known to be responsible.
2
 
4:35 PM
Is there an equivalent of this in netcore?
var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
 
!!tell gbade_ googleme urlhelper net core
 
@SebastianL Dope command.
Almost as good as mcve
 
Not a good day for me if I can't figure out this basic problem
 
4:54 PM
@JetsYanks08 i think my crystal ball is broken, so could you enlighten me with your question?
 
Lol same one as before
 
which was? (sorry for not remembering)
 
Can somebody help me do a reality check? IdentityServer3 is throwing the most bizarre TypeLoadException with one of the autogenerated classes (DisplayClass and friends)
If I have a Type object "t" that's been seemingly loaded successfully, as in I can see its properties and all that, then doing "Type.GetType(t.AssemblyQualifiedName, throwOnError: true)" shouldn't throw right? But it does...
I can get the Type object by just getting the parent class of the type and then doing .GetNestedTypes(BindingFlags.NonPublic)[0] so the type does exist, just loading it by "some other means" doesn't work. Not being able to load the weird nested inner class with GetType isn't the real problem but I've narrowed it down to a small console application that crashes.
 
@MattiVirkunnen To resolve a type which is generated or loaded on runtime, don't you have to supply the assembly to the method?
2
Q: Should Type.GetType(string) be aware of dynamically generated types?

Filip FrączI have an app which creates some code using CodeDom compiler. I can see that the generated assembly is in memory. But when I call Type.GetType(typeName), it returns null. I find this a little bit confusing. What am I doing wrong? static void Main(string[] args) { // FYI: Code is some dummy...

 
It's not a dynamic type, it's a compiler-generated type that's part of an async method.
It's there in the DLL, I can see it with Reflector
And it loads fine by loading the parent class by name and then doing GetNestedTypes
Trying to load it with Assembly.GetType and the correct assembly fails as well
I'm starting to suspect there's something seriously wrong with the IdentityServer3 package on Nuget. I know they've ILMerged a lot of things into the DLL and that's always sketchy.
 
5:01 PM
hmm sorry then i don't know either
 
Fusion logging gives me a "WRN: Partial binding information was supplied for an assembly:" but I'm not entirely sure why that is
That's a bit suspicious though. This assembly also doesn't have a strong name for some reason it seems
 
5:26 PM
I guess I'll have to post an actual question heh, but it still feels like a long shot...
 
user9145305
Iam about to just ask another question lol
 
@Cuphead did you solve your group problem?
 
user9145305
Nope, I am an idiot.
2
 
ok
and I assume that the "another question" is for something else
 
user9145305
no, it was the same problem
 
5:41 PM
I see
what do you have so far?
 
user9145305
All I want to is recursively do what I did if the element is a groupdecision
 
So
if (group is GroupDecision decision)
                    {

                        if (ParentObjectHelper(decision, Source))
                            {
                            parentObject = decision;
                            GetParentGroupObject(root, source)
                    }
 
Welp, I ended up making a workaround and just not touching that assembly
 
@Cuphead you ignored my suggestion
 
user9145305
5:50 PM
I tried yours
 
not really a smart move
how far did you get with mine?
 
user9145305
I was sketching it out but couldn't see it through with use Select over Where/Any
 
then first do the other parts
the GroupDecision and the else
 
6:16 PM
The key here, as with anything, is believing in yourself
 
The talking horse is right.
 
user9145305
trying
 
Non-talking horses are right less often, according to science.
 
and wrong less often
 
@Grace can you perform basic arithmetic?
 
6:39 PM
If not, I can certainly fake it with the help of a human giving me the answers.
 
user9145305
6:51 PM
Just weird that I can hard code N levels and the code will work but if I try and just make it recursive, it breaks
 
That's not weird at all.
Disclaimer I haven't been following the problem.
 
@Cuphead its because you havent got a clue how to make it
 
Truly your diplomacy knows no bounds.
 
Lets make recursion great again!
 
user9145305
oof
 
6:55 PM
ouch owie my base case
 
Have you tried using more LINQ
Or, failing that, the debugger
 
he should try groups.Select(RecursiveCallToTheMethod).FirstOrDefault(item => item != null);
 
Can't hurt.
 
that is basic tree based recursion
 
 
3 hours later…
tin
10:18 PM
Hi there, how are you? long time :) I'd like to know if it's possible to set multiple properties of an instance after it's...well, instanced. Instead of using the constructor+initializer. Example:
var someThing = new SomeThing();
// some logic then
someThing { Prop = 1, AnotherProp = 2 }
instead Of: new SomeThing() { Prop = 1, AnotherProp = 2 }
 
If you always want to set those two properties, you could have a function on something that sets them for you.
Or even just
something.Prop = 1; something.AnotherProp = 2
 
I have a math question from an obscure C# code, what's the best room for it?
 
The answer is six. You're welcome.
 
@tin you should try to postpone the allocation of the object
 
tin
Thank you, Grace. I was just wandering if there was any fancy way to set multiple as a single statement, but surely a method for it would be better.
 
10:27 PM
some logic should be able to be done without the someThing instance
or the some logic should be able to be done after the properties are set
 
Or put some of this logic into the object
 
tin
:) yes that sounds less crazy
well thank you! good night!
 
Follow your dreams, tinman.
 
@Grace 6/0
 
Happy to help.
 
11:09 PM
Anyone here?
 
11:25 PM
nope
 
@Wietlol lol
@Wietlol Have you worked with Html Agility pack?
 
nope
 
@Wietlol Neither have I, just started few hours ago! Trying to scrape a web page
 
02:00 - 12:0012:00 - 00:00

« first day (2748 days earlier)      last day (2217 days later) »