text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : I am designing a HangMan game to learn how to use C # with DevExpress.My problem is that I am drawing the post with size relative to the panel size I am drawing it into , so that its size is recalculated if the window is resized . My code looks like this : This works perfectly for me , and the post drawing is... | Image is duplicated when the window is maximized |
C_sharp : I stumbled upon this weird thing today : http : //www.yoda.arachsys.com/csharp/teasers.htmlQuestion # 5 . The code : Now according to the answers on http : //www.yoda.arachsys.com/csharp/teasers-answers.html for question # 5 ... It 's a known bug due to some optimisation being done too early , collecting cons... | Why should n't this compile ? |
C_sharp : I am using ZXing.Net library to encode and decode my video file using RS Encoder . It works well by adding and and removing parity after encoding and decoding respectively . But When writing decoded file back it is adding `` ? '' characters in file on different locations which was not part of original file . ... | Unusual Character addition after writing back decoded file |
C_sharp : Is there a way to do this in C # ? I do n't want to have to say sc.Value every time i need to access the value . <code> public class SampleClass { public int value ; public SampleClass ( int v ) { value = v ; } } // i want to access value like thisSampleClass sc = new SampleClass ( 5 ) ; int i = sc ; | How do you make this parameter access syntax possible ? |
C_sharp : I have this code written by another programmer and I cant get my head around itFrom my understanding the AppBase class of type T implements the interface IApp where T implements ? ? ? Can some one explain the last part ? <code> public abstract class AppBase < T > : IApp where T : AppBase < T > , new ( ) { // ... | Whats happening in this Self referencing inheritance code ? |
C_sharp : Is it possible to test for the existence of an attribute within the code of another attribute ? Say you have the following class definition : ... is it possible for MyTestAttribute.IsValid to determine whether Inception.Levels has the RequiredAttribute ? <code> public class Inception { [ Required ] [ MyTest ]... | Test for Attributes From Within the Code of Other Attributes |
C_sharp : As you can see at this link , it was possible to separate the rooting and the implementation of the old nancy1.X modules . Now that the way of defining these routes have changed , I would like to know how to code the same separation logic.For clarity , the old way to define a Get route was : Get [ `` / { cate... | How to separate interface from implementation in nancy2.0 ? |
C_sharp : I have a webapi that returns an object that contains some collections of objects which also contains a collection of objects . Each of these objects has a bool that represents if the object is 'published ' See classes below for general idea.What is the best way to make it so when I serialize any of these obje... | Limit objects in a collection from being serialized based on User |
C_sharp : I want to create a class that have a class but this second class may be different each time the first class is called . For example : How can I do it to call the ServerResponseObject with different objects each time , once with TVChannelObject and once with ChannelCategoryObject ? <code> public class ServerRe... | How to specify a class that may contain another class |
C_sharp : I find myself repeating calculations within a linq statements and I was wondering whether I can access already computed elements somehow . This is what I m doing : Which works fine.This is what I would like to be doing : where the price is the price I computed just after rundate . Can I access this somehow ? ... | Using already computed element |
C_sharp : I 've looked at the other questions around this and I just ca n't work out how to apply the answers to my particular situation . Say you have a couple of models that look like this : I want to be able to write a couple of different generic methods : one that gets the models using a provided Lambda that might ... | Using the logic from one lambda within a second lambda |
C_sharp : I have this code : I do also handle UnobservedTaskException ( by logging it ) . The problem that I face is that after task1 fails and first await results in exception , task2 completes in an error and then I have a log entry that I do not want to see as I will already log the first exception and at that point... | How to observe tasks that are not awaited due to failure in another awaited task in C # ? |
C_sharp : i am developing application using C # ( 5.0 ) .Net ( 4.5 ) .I want to know whats the difference between below to declaration of dictionary variable.1.and 2.in 2nd declaration i have used ( ) after Dictionary < string , object > . both syntax works fine but just eager to know about internal work . <code> var e... | Difference between define dictionary |
C_sharp : I currently work on a .net core api project with VSCode , and I want to integrate ASP.NET Core Authentication and Authorization with a cookie . I tried to add services.AddAuthentication ( ) ; and services.AddAuthorization ( ) ; in Startup.cs . I 've also add the [ Authorize ] attribute in my UsersController.c... | Setup ASP.Net Core Authorize and Authentication Properly in a .Net Core 3.0 project |
C_sharp : string in C # is a reference type that behave like value type . Usually programmers do not have to worry about this since strings are immutable and the language design prevents us from doing unintentional dangerous things with them . However , with the use of unsafe pointer logic is it possible to directly ma... | Unsafe string manipulation mutates unexisting value |
C_sharp : So , this one is pretty straight forward I think.Here is my code : What is happening is that in the end the dictionary will have all the correct keys , but all of the values will be set to the fileTypes list created during the final iteration of the loop . I am sure this has something to do with the object be... | Altering object is affecting previous versions of object in a foreach loop |
C_sharp : My site calls a service ( let 's call it FooService ) that requires a very complex set of authentication protocols . The protocols are all wrapped up in a custom ClientCredentials behavior that is declared like this in code : We then register the behavior extension : Configure an endpointBehavior to use it : ... | Can you change a BehaviorExtension with WCF configuration ? |
C_sharp : I 've read numerous articles related to proper equality in C # : http : //www.loganfranken.com/blog/687/overriding-equals-in-c-part-1/What is the best algorithm for an overridden System.Object.GetHashCode ? Assume the following sample class : Would it still be the case to compare the Values property using .Eq... | C # equality with list-based properties |
C_sharp : While trying to find the best approach to implementing a catch-all for any uncaught exceptions I found this.But , while implementing it , I remembered where I read : WARNING Do n't modify the Response object after calling next ( ) ... , as the response may have already started sending and you could cause inva... | Are exceptions an exception to the rule about not modifying the Response after next ( ) ? |
C_sharp : Say I 'm using an external package for storing graphs . A BidirectionalGraph takes two templates : a vertex and an edge type : Unfortunately , this graph package does n't allow you to get the edges radiating into a vertex in a single line . Instead , you have to provide an IEnumerable , which it will populate... | Allow templates to be inferred |
C_sharp : We often use event handler in C # , just as below : Does this happen at compile time or run time ? What if the some_event is static member ? AFAIK , the some_event contains nothing but the entry address of some_event_handler , and the method address of some_event_handler could be determined at compile time . ... | When does event handler registeration happen ? |
C_sharp : Given the following code ( which I know wo n't compile and is n't correct ) : And this example setup : How can I structure my code so that this will work ? TLDR ; I 've thought about this a little more . A different way to state my question is : how do I run the Fetch method on all the items in the myFetchers... | Allow derived type cast as parent type to return ` object ` , but using the derived type 's method |
C_sharp : So I have created a provider ( a few of them actually ) and I am realising there is a bit of a pattern in some of my logic . It is being repeated and I reckon I can remove lots of lines of code if I can just create this extension method : DSo , basically what is happening is something like this : Now , I do t... | Static Method for handling null returns |
C_sharp : This is a bit of a weird one.I 'm building a web application and I was putting together a simple factory-pattern-like thing to handle some object instantiation . I do n't like big ugly switch-case blocks , so I tend to do this : and then the switch block becomes MyBaseClass selectedThing = OptionMapping [ cur... | Dictionary < X , Func < Y > > accessing the containing Dictionary from a Func < > within it |
C_sharp : I have researched into this extensively , but can not seem to find anything in its regard.If I was to use an if statement as a validation and needed to write something along these lines : Could I write the above as the following with the same result : I can not see the result of this and am wondering if in th... | What would +- do as an operator in c # |
C_sharp : I am looking for a way to inherit generics with inherited parameterizations - or if that 's not possible , the closest way to get the same functionality.Consider the following : Class B inherits from class AClass D inherits from Class CNow , I have one class : with constructor : Now , I wish to extend class A... | Inheriting generics with inherited parameterizations |
C_sharp : The short version : What is the best way of overloading two methods , when one accepts an Expression < Action > , and another accepts an Expression < Action < T > > ? The longer version : Let 's say I have the following methods in a ( badly designed ) class : Now , it may be me being particularly dim , but I ... | Overload precedence between Expression < Action > and Expression < Action < T > > |
C_sharp : This code gives an error : But if I separate the classes , there is no error : <code> public class A < T > { public class B < T1 > : A < T1 > { public static implicit operator bool ( B < T1 > b ) = > true ; } } public class A < T > { } public class B < T > : A < T > { public static implicit operator bool ( B ... | Why does an implicit operator method in a nested class not compile ? |
C_sharp : I 'm having some troubles when saving in the database a model with a little complex relationship.The UML of the classes is : The classes definition are : I 'm able to run a migration and looking into the database the tables and columns created by the framework seems fine to me . But , when saving an exception... | EF relation one-to-two |
C_sharp : In my app , I have a method that gets invoked every time an update happens on some queue on a server . The app is initialized to behave this way.Now , each time the method is invoked with the latest data , I want to treat it like a part of a stream of event and hence make this a part of an Observable that nev... | Create an observable on a method |
C_sharp : I want to match the following strings : Can I achieve this using only one regular expression ? I am currently using this one '^\ [ ( { ) ? .+ ( } ) ? ] $ ' , but it will match also : I need to to match } only if { is used.Please , note I can use only regular expression match function as I have implemented it ... | Regular Expression - Match End if Start is Match |
C_sharp : Consider the following scenariowhere multiple threads access this variable via a method callingwhere this method does some heavy weight operations to retrieve the dataMy problem here is that if I useGetorAdd the HeavyDataLoadMethodgets executed even if it is not needed.I was wondering if there is some way to ... | .NET Force method deferred execution |
C_sharp : How do I refactor this code so I can centralize the projection ? Basically , I have lots of case statements and a long projection on each case statement . I 'm worried that once the DTO needs to change , say add a new field , the other cases ' projection might not be consistent with each other ( forgot or mis... | Centralizing or consolidating LINQ select |
C_sharp : Say I have the following method : And then I use this method in a LINQ query like so : This fails with : Error 1 The type arguments for method 'System.Linq.Enumerable.Select ( System.Collections.Generic.IEnumerable , System.Func ) ' can not be inferred from the usage . Try specifying the type arguments explic... | C # Type Inference fails with methods that contain default parameters |
C_sharp : I 'm just messing around with some data types of C # in order to understand them.I 've been trying for a while to understand why this dictionary is turned into a KeyValuePair.Here 's my code : And I 'm getting this error : Error CS0030 Can not convert type 'System.Collections.Generic.KeyValuePair < string , i... | Why is Dictionary transformed into a KeyValuePair here ? |
C_sharp : Hey its a simple script whit animation params , but I do n't know why my if with getkeydown is not executing ! Its suppose to play an idle animation if key is not being pressed but thats not happening instead its just not going trough that part of the code . <code> public class PlayerMovement : MonoBehaviour ... | My getkeydown is not being recognized |
C_sharp : I got into some trouble with EntityFramework and the following datamodel ( see simplified diagram ) .The Matter object can be thinked as the `` main container '' . There are Bill and BillRecord . There is a one-to-many association from Bill to BillRecord . Precisely , a Bill can reference many BillRecord ( po... | EntityFramework : CascadeOnDelete only if parent object is deleted |
C_sharp : I have a method that manipulates a value tuple with multiple fields . That tuple is returned from another method and deconstructed , in order to simplify further usages of its fields : However , now I need to pass the entire tuple down to another method that expects it : Is there an easy or clean way to `` re... | How to reference a deconstructed value tuple without making a copy of it |
C_sharp : In a console app , from a static method in main class Program , I am calling : I have both set a break-point , and also checked the expected outcome ( module installed locally ) , but from all indications the method 'EnsureModuleLocalInstall ' is not being executed.Am I missing something obvious , or am I exp... | Why wo n't a method execute from within LINQ Where method |
C_sharp : I 've got the following typo : used in the following : I intended it to be += , but I 'm left wondering what `` = +var '' means.. <code> subcomponentGroupCount = +subcomponentCount ; int subcomponentGroupCount = 0 ; foreach ( Subcomponent subcomponent in group.Subcomponents ) { int subcomponentCount = task.Ta... | What does =+ mean and why does it compile ? |
C_sharp : How do I retrieve values from @ for loop into jquery..Each value inside for loop should have different id , and jquery should get each separate id ... .My for loop , My jquery which is n't helping , Thanks in advance ... <code> @ for ( int i = 0 ; i < searchList.Count ; i++ ) { < label for= '' input @ i '' > ... | Retrieving values from for loop into jquery |
C_sharp : I tried to reference System.Device in a Razor view of my MVC C # project . It complained that the reference was missing even after I added it to the project . I did not have the assembly in my GAC , and to test I added the below dummy line in my global.asax.cs file ( and compiled with multiple debug flags ena... | How to determine if Copy Local is necessary |
C_sharp : I have a console based MEF application the host ( CompositionContainer ) of which loads available plugin assemblies based on the command line parameter , for example : will load the host ( app.exe ) and plugin1 . The VS solution is structured such that each plugin has it 's own project ( hence it 's own assem... | Utilising methods available in plugin1 in plugin2 via MEF |
C_sharp : Given the following example class : If I am reflecting against method Foo < > .Bar < > ( ... ) , and examining the parameter types , say : both argType1 and argType2 look similar : FullName property is nullName property is `` T '' or `` S '' respectivelyIsGenericParameter is trueIs there anything in the param... | Distinguish between a class generic type parameter and method generic type parameter |
C_sharp : I do n't understand what the difference between these 2 variations are . What is the pros/cons of each approach ? <code> 1. a.MyEvent += new MyClass.MyEventDelegate ( FireEvent ) ; 2. a.MyEvent += FireEvent ; | Should I new-up a new delegate or just add the method to an event ? |
C_sharp : I have a library of html helpers as a separate project . Right now it references system.web.mvc of version 4.If I try to use this library in a project that uses mvc3 it throws an error when a helper is attempted to be used : I understand that I need to build my helpers project with system.web.mvc of version 3... | How to set up project of htmlHelpers so that it produces two dlls - for mvc3 and mvc4 ? |
C_sharp : I want to create a game where you try to avoid objects ( circles ) that are `` attacking '' you . The way I did this : First calculate the x_and y difference between the object and me ( in this code AI_x is the object 's x-location ( AI_y : y-location ) and x , y the player 's location ) Calculate the angle t... | Attack/Follow my player |
C_sharp : I have textual table : where I would like to match all numbers , except those in first column.I 've tried to use negative lookbehind without success : How to match all numbers except those in first column ( 13.5 , 14 , 14.5 , 15 , 15.5 ) ? <code> 13.5 0.12557 0.04243 -0.0073 0.00377 14 0.12573 0.05 -0.00697 0... | How to skip a column ? |
C_sharp : If I have a generic method like this one : I could call it by specifying an interface type , for example ICollection < int > Now assume I have a struct that implements ICollection < int > : I ca n't specify it explicitly as the type argument , but if I have a variable of type ICollection < int > that has the ... | Why specifying a generic argument as interface is not an error with a class constraint ? |
C_sharp : I have the following method which is used to retrieve all values as strings from an object using reflection . The object can have IEnumerables within them and I also want to retrieve these values . A list of ignore fields also needs to be taken into account so that those field 's values are not returned.This ... | Strip all values from C # objects using Reflection |
C_sharp : If not and the set of reference types and value types are mutually exclusive , why does n't this compile : The compiler states : `` Type already defines a member called 'Do ' with the same parameter types . `` , but T and T are not the same here . One is constrained to structs , the other is constraint to cla... | Can a type be a reference type and a value type at the same time ? |
C_sharp : I 'm new to Windows 8.1 development , so forgive me if this question is obvious or rudimentary . I 've experimented around with the various attributes quite a bit , and I ca n't make it work the way I want it to , so I figured maybe someone here could give me a hand.A description of what I 'm doing : I made a... | How do I make my TextBlocks be the correct sizes in my C # XAML Windows 8.1 app ? |
C_sharp : I have the following scenario : I 'm trying to lock a thread in place , if that threads 'custom ' id matches the one that has already entered the locked section off code , but not if the id differs.I created some sample code to explain the behaviour I want Now this works 100 % for what I extended , where id e... | Improved Thread locking advice needed |
C_sharp : I 'm experimenting with custom integer types and came across an interesting issue involving generics , implicit conversions , and 32 bit integers.Below is a stripped down example of how to reproduce the problem . If I have two implicit methods that convert int to MyInt and vice versa , I get a compilation err... | 32 bit implicit conversions fail generic overload resolution |
C_sharp : I have a folder fuill of images and have the image name and the full file path stored in an array in my program . Is it possible to get just the folder and the filename from the filepath.So If I have a filepath ofI need to get <code> C : \Users\Ryan\Documents\myImage.jpg Documents\myImage.jpg | Get the folder of a file . |
C_sharp : Why does the following crash with a NullReferenceException on the statement a.b.c = LazyInitBAndReturnValue ( a ) ; ? Assignment expressions are evaluated from right to left , so by the time we are assigning to a.b.c , a.b should not be null . Oddly enough , when the debugger breaks on the exception , it too ... | Member references and assignment order of evaluation |
C_sharp : My object like like thisI have a list of this objects in this class Where data is like thisI want to filter this list so that I can get an output like this ( all the possible combination of city and region regardless of postcode ) .I have wrote some query like thisBut this is giving me a result of first item ... | Get distinct items by combination from list C # |
C_sharp : I have two simple classes.I build and instantiate class C like below.The problem is I can successfully instantiate class C. When I check the type and value of C.A it was very surprising for me.Briefly , I have following classes which are working ! My questions are : How can this be possible ? At which level d... | How can Reflection.Emit assign incompatible types ? |
C_sharp : I am trying to get the latest contact with a given user , grouped by user : The user 's contact info could either be in SentTo or SentFrom . would give me the latest message , but I need the last message per user.The closest solution I could find was LINQ Max Date with group by , but I cant seem to figure out... | How do I group on one of two possible fields using LINQ ? |
C_sharp : Sometimes , during development phase , I need to see if e.g . a name is changed for each element created or just wish to differentiate between different instances ' names in an array . That behavior is strictly for development-stage and only to be applied during a short period of time ( hence no need to long ... | How to count without a counter in a select ? |
C_sharp : I 'm getting a massive payload of XML from my WCF service , and I need to write it into a SQL database . I 'm using the latest version of .NET and Entity Framework 6 . `` Okay , that 's great , '' you may say , `` but what 's the question ? `` Well , the XML is being deserialized into C # objects ( generated ... | Ignoring null references when de-serializing a massive XML document |
C_sharp : When doing this in C # : The compiler complains that `` the type or namespace 'Word ' could not be found '' . Is this not possible ? If it makes a difference , I 'm trying to do this in the global namespace.EDIT : just found another SO that answers this : Why can one aliased C # Type not be accessed by anothe... | Can a type alias refer to another type alias ? |
C_sharp : I have an string array containing names like : That I convert to a List < string > Then I need to write a function that returns the max repeated item in the list but should be sorted in descending order , which in this case , Michael.I have followed the LINQ code stated in this link . Which is : However , cod... | LINQ Return max repeated item but sorted in reverse |
C_sharp : I have a panel ViewStock where i am viewing stock in a gridview from database and DataBind ( ) it via code . Allowed paging and created and event `` OnPageIndexChanging '' in gridview tag in html , Implemented the defined code above and paging in an event as follows : HTML : Code C # : And now the Implemented... | GridView do n't Show on GridView_PageIndexChanging |
C_sharp : I have to create a method that verify if a number follow a certain structure , and it must follow a existing pattern implemented in PHP , but I 'm having certain trouble doing thins in C # .NET . When the number went too long I got a System.OverflowException , I 'm using ulong , take a look : And I have to re... | Big number in C # .NET |
C_sharp : I am working on alpha.dubaiexporters.com . There is a search Panel containing two inputs Keyword and Categories . I wanted to validate Keyword part.If the user entered less than three characters and clicked on Search button then the clientside message should be displayed saying the entered input should be mor... | Not getting the clientside message after clicking on Search button |
C_sharp : Consider the following IDisposable class : Every method in this class , including Dispose ( ) , should begin with a check like this : Since it is tedious and repetitive to write this in all methods , I would like to use contract invariant : However , this only ensures IsDisposed is false at the end of each pu... | Using invariant for IDisposable |
C_sharp : I have this : and I am just saying if the value is above 10 then change it to 255.But , it is quite slow.Is there a quicker way to do the above ? <code> var data = new byte [ 100,100,1 ] ; //data is populated from external sourcefor ( var h = 0 ; h < 100 ; h++ ) { for ( var w = 0 ; w < 100 ; w++ ) { if ( Data... | Faster way to manipulate mutli byte array |
C_sharp : Below I have a solution to get attributes from fields with an extension method . Now I want to do a similar thing with methods instead of fields.Usage : So in my case the usage should look something like this : Is this possible in any way or do I have to try something completely different ? <code> public stat... | Accessing attributes on methods using extension method |
C_sharp : I 've designed a Windows Forms dialog that should be reusable in other applications , WPF and Windows Forms . This works fine when I use it in a Windows Forms application , but it causes some layout trouble when called in a WPF application . Dimensions and sizes are inconsistent when measured from the pixels ... | Dialog has unrequested additional space |
C_sharp : I am running this code in Unity ( Mono backend with .Net 4.x ) In Debugging ( with Visual Studio ) , compare1 is false while compare2 is true.How is this happening ? Why are the last two lines different ? I would think that sum == a + b . <code> float a = 0.42434249394294f ; float b = 1 - a ; float sum = a + ... | Comparing the sum of floats |
C_sharp : I want to ask , can you do something similar to this ? Event is a classI want to do something similar to delegates : Thanks . <code> Event += eventInstance ; Write write1 = new Write ( ( ) = > Console.WriteLine ( `` Write1 '' ) ) ; Write write2 = new Write ( ( ) = > Console.WriteLine ( `` Write2 '' ) ) ; Writ... | C # adding objects ( similar to delegates ) |
C_sharp : The goalChange the model depending on what it is expecting.The problemI have a method in my ProductsControllercalled Category . When someone request this method , two things can happen : if the parameter passed to the method is different than Daily-Offers , then one type of list is passed to View . If the par... | Set the model depending on what it is expecting in view |
C_sharp : N.B . refer to this link.I wrote this class to be used as a proxy in the server-end and as a client at the client-end.My current source code is the following : The problem I am facing with this code is : are going to the other end as only one input : , rather than three separate inputs { `` 1 '' , `` 2 '' , a... | Different data written to the server are becoming appended to become a single string |
C_sharp : I 'm making a program with multiple types of binary trees in it . So I decided to make an abstract class , to avoid copying code over . But there is a problem , the nodes of each tree need to contain children that are the same type as the node itself . Is there any means to define this in the abstract , or sh... | Abstract with inheritor as field |
C_sharp : Say I have the elements with the ID 's of `` Input1 '' , `` Input2 '' and `` Input3 '' .Is there a way to loop through them rather then having to write : in jquery you can just refrence an element like $ ( ' # Input'+i ) and loop through i , something similar would be very useful in ASP code behind . <code> I... | Can we dynamically reference element ( Server Side ) |
C_sharp : I have the following function which is intended to `` memoize '' argument-less functions . Meaning to only call the function once , and then return the same result all other times.Can I be certain that if a thread reads `` inited == true '' outside the lock , it will then read the `` value '' which was writte... | Memory read visibility ordering vs write order using double-checked locking |
C_sharp : I am using TPL blocks to carry out operation that may be cancelled by user : I have come up with two options , in first I cancel whole block but do n't cancel operation inside the block , like this : and the second I cancel inside operation , but not the block itself : As I understand , first option will canc... | Correct way to cancel TPL data flow block |
C_sharp : In TypeScript I can declare an array such as : Is there a shorthand way I could do something similar in C # ? I find myself mutating and mapping lists a lot and it gets cumbersome to explicitly declare classes and interfaces for each different operation . <code> const arr : { id : number ; value : string ; } ... | Inline/shorthand types in C # |
C_sharp : I have a class : From a List < Point > , say I want the Point where Point.X + Point.Y is maximum in the list . How would I do this in LINQ ? <code> class Point { double X , Y ; } | Return the element of a list which fulfills a certain condition |
C_sharp : I ca n't believe how frustratingly difficult I 'm finding such a simple task.I want to create a link with a page query argument.I tried the following : And here 's the link that is generated.I 've been Googling for an hour . Can anyone tell me the Razor Pages way to create a link with a query argument ? Also ... | Razor page link ignores route argument |
C_sharp : I 'm using Task to process multiple requests in parallel and passing a different parameter to each task but it seems all the tasks takes one final parameter and execute the method using that.Below is the sample code . I was expecting output as : 0 1 2 3 4 5 6 ..99 but I get : 100 100 100 ..10 . May be before ... | Why would Task object not use parameter passed to it ? |
C_sharp : If i have 3 DateTime lists that come from different sourcesWhat would be the quickest way to return a list of DateTime that exist in all 3 of the lists . Is there some LINQ statement ? <code> List < Datetime > list1 = GetListOfDates ( ) ; List < Datetime > list2 = GetAnotherListOfDates ( ) ; List < Datetime >... | What is the easiest way to seeing if there are any matches across a few DateTime arrays ? |
C_sharp : I have tried the solutions I have found and can not seem to make this work for me.I have a class : I make a call to a service : And now I want to sort the Reports list in callResponse by CompletedDatecallResponse.Reports.Sort ( ( x , y ) = > DateTime.Compare ( x.CompletedDate , y.CompletedDate ) ) ; This retu... | Sorting List by DateTime |
C_sharp : Suppose I have a class : And an extension method : What would be the most convenient way to remove the FooExtensions class and alter Foo so it becomes : ReSharper does n't seem to offer a one-step action to do this ( strangely enough as this seems a pretty straightforward refactoring ) , but which other actio... | Converting extension methods to instance methods with ReSharper ? |
C_sharp : I am sending the Json format like this in PostManIn controller level i am doing the validation of all fields.After validation how can i convert the above json string to below formatAnd aftre converting , i want to insert to database.How to convert in c # ? Please help me.And the below code is the class for st... | How can i change the json formate after request in c # ? |
C_sharp : I have two grids on my form . Whenever a row gets focus in grid1 , its associated children rows are fetched from the database via ADO.NET and grid2 's DataSource is reassigned as follows : ASIDE : grid1 contains many rows so I do n't want to fetch the children rows for all of the parent rows in one ( time-con... | Will reassigning datasource cause a memory leak if listeners are not removed first ? |
C_sharp : This class declaration : Can not be fulfilled by this class signature : Where SqlEntity : IEntity and SqlDataProvider : DataProvider < SqlEntity > , I get this error : Error 1 The type ~ can not be used as type parameter 'TD ' in the generic type or method '~.Repository ' . There is no implicit reference conv... | Can not inherit with generics |
C_sharp : Is there a way to add a attribute or something to a class that whenever a property of that class gets called that a method will be called ? Basically i have classes that contains a datarow and instead of accessing the individual column like : ( DataRow [ `` some_column_name '' ] ) I want to access them using ... | Call a method whenever a property is called |
C_sharp : I 've got a form with a submit button , and I want to show a dialog before continuing the form submission . The code below is showing the dialog properly , but it continues the submit anyway : <code> @ using ( Html.BeginForm ( `` SubmitForm '' , `` Home '' , FormMethod.Post , new { id = `` form '' } ) ) { @ H... | How can I show a dialog before submitting ? |
C_sharp : For a library ( .NET Standard 2.0 ) , I designed some classes that look roughly like this : The classes were criticized because of that `` MyContext '' parameter that every constructor requires.Some people say that it clutters the code.I said that the parameter is needed to propagate the context , so that e.g... | Passing the context around in a C # class library , looking for an `` easy '' way without using static |
C_sharp : I have a method like this in my libraryI want to refactor it and remove the generic parameter.How does it affect the code dependent on my library ? Do they need to do a rebuild ? Do they encounter compile error ? What if they have used reflection to call this method ? If I create both of them then the method ... | Removing generic parameter from method signiture |
C_sharp : I am just wandering if the following is possible in C # .Let 's say I have a List-like interface that mandates the operation reverse . I.e . : However , now when I go and implement that interface : I am still forced to use the interface ReversableList . So even if the user were to instantiate my ListImplement... | Allow implementing classes to use themselves as types |
C_sharp : I have an array of MyClass , which can be simplified as follow : Now , in the Array , without any errors from the user side or throughout the input process , there can not be MyClass instance with identical Id and Origin . However , if there be any , I should resolve it . And here are the resolving rules : Fi... | LINQ Solution for Multiple Resolves |
C_sharp : I got stuck with attempt of generic casting or building a LINQ expression that could be casted to the required generic type T.Here is the failing example : Is there any way to cast T or build a Linq expression that would treat T as ICompanyLimitedEntity and execute the query on the SQL server ? <code> public ... | Casting generic type to build a valid Linq expression |
C_sharp : Something is dropping my running tasks beyond a certain point in the code ( see where below ) . It just stops executing . It only happens on iOS devices . On iOS simulators and android devices it runs perfectly . Anyone seen anything like this before ? I do n't think it 's deadlocks or race conditons , becaus... | iOS dropping Tasks in the middle of execution |
C_sharp : I have a UserControl which a couple of buttons and some Textblock 's . For some reason , the TextWrap is not working for this Textblock.The output ( The selected part = second StackPanel ) while the part where I have the mouse = the second textblock with the TextWrapping property set to Wrap.See here <code> <... | TextWrap in StackPanel |
C_sharp : I have a methodand the idea is to use it this wayhowever it is an error to create a nested expression even though the compiler will accept itnow I can catch this at runtime by parsing the expression tree . For exampleI was wondering however , is there any clever way to detect this at compile time ? I doubt it... | Is it possible to statically verify structure of c # expression tree arguments ? |
C_sharp : I have been thinking about this problem for a while and it feels like there must be a simple solution that I 'm missing.Let 's say I have the following class : If I get all constructors on the type Foo < System.Int32 > I will get back two constructors , both with a single parameter of type System.Int32 which ... | Matching constructor to counterpart in generic type definition |
C_sharp : I made my own SQL string that uses INNER JOINS . Here is my function : Now the problem is , when I click one Item on the stocksList ListView the recipeList ListView would have multiple values . Like 5 or so rows of the same values . <code> string cmdstr = @ '' SELECT s.* , mdb.menu_name FROM stocksdb s , reci... | Duplicating values because of SQL string ? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.