text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : I have a class defined like this : But when I serialize it , `` version '' does n't show up in the attribute ( while `` action '' does ) .What 's going wrong ? <code> [ XmlRoot ( ElementName= '' request '' ) ] public class Request { # region Attributes [ XmlAttribute ( AttributeName = `` version '' ) ] public... | C # Xml why does n't my attribute appears ? |
C_sharp : Suppose I have a method which changes the state of an object , and fires an event to notify listeners of this state change : The event handlers may throw an exception even if IncreaseCounter successfully completed the state change . So we do not have strong exception safety here : The strong guarantee : that ... | Can I have strong exception safety and events ? |
C_sharp : I 've just started experimenting with CodeContracts in .NET 4 on an existing medium-sized project , and I 'm surprised that the static checker is giving me compile-time warnings about the following piece of code : Why is the CodeContracts static checker complaining about the strs.Add ( ... ) line ? There 's n... | CodeContracts - false positives |
C_sharp : I have the following expression : When I perform a split as follows : Then it gives me three entries : Why does it give an empty line as the third entry and how can I avoid this ? <code> `` < p > What ? < /p > \n < pre > Starting Mini < /pre > '' var split = content .Split ( new [ ] { `` < pre > '' , `` < /pr... | Why does C # split give me an array ending in an empty line ? |
C_sharp : I 'm new to COBOL and I have been trying to read record information from a text file that is an output from the table.Most non-comp data-types i 'm okay with , it 's the 'COMP ' ones i 'm getting stuck on.I 've been trying to figure this out all day today reading as much as I can on this.The date fields below... | Read COBOL COMP data in C # |
C_sharp : I am Working on Xamarin.iOS.In the TableView . I am bind the Cell with Button.For Button Click I am doing Subscribe and Unsubscribe Cell event by below codethis is not working fine when I call data api again and set to the TableView.Explanation : When I open ViewController first time cell button click event f... | Subscribe and Unsubscribe cell button Click event is not Working in iOS 11 |
C_sharp : I have a simple test code that works as expected in .NET3.5 , but the same code behaves completely different on a project created with .NET4.5.1.First of all , the weird thing is that the NullReferenceException type exception is completely ignored in .NET4.5.1 when running the compiled RELEASE exe file . Basi... | Try-Catch-Finally block issues with .NET4.5.1 |
C_sharp : Should this regex pattern throw an exception ? Does for me.The error is : parsing `` ^\d { 3 } [ a '' - Unterminated [ ] set.I feel dumb . I do n't get the error . ( My RegexBuddy seems okay with it . ) A little more context which I hope does n't cloud the issue : I am writing this for a CLR user defined func... | Should this regex pattern throw an exception ? |
C_sharp : SetPartitions method accepts an array of prime numbers such as 2 , 3 , 5 , 2851 , 13.In the above example , it should assign : How to implement the logic ? <code> public int Partition1 { get ; set ; } public int Partition1 { get ; set ; } private void SetPartitions ( List < int > primeNumbers ) { this.Partiti... | How to find out the closest possible combination of some given prime numbers to 10000 ? |
C_sharp : I 'm trying to use the SearchBox control introduced in Windows 8.1 , but I ca n't figure out how to display the image in the result suggestions . The suggestions appear , but the space where the image should be remains blank : Here 's my XAML : And my code behind : Am I missing something ? Some extra details ... | Image not shown for result suggestions in SearchBox |
C_sharp : I use C # , .NET 4.5 , Console application.I added WSDL file in service reference . Inside WSDL are validation rules like : There is XSD file too , with details of validation rules like : And I have automatically generated properties from WSDL in Reference.cs like : I serialize xRequest object into XML and I ... | How validate XML with XSD , when part of validation rules are in WSDL |
C_sharp : It has been a while since I 'd understood covariance , but should n't this compile ? Anything bar can return is also an IMyInterface . What seems to be the problem ? <code> public void Foo < T > ( Func < T > bar ) where T : IMyInterface { Func < IMyInterface > func = bar ; } | Covariance , delegates and generic type constraints |
C_sharp : I surfed into this site a few days ago on `` Anonymous Recursion in C # '' . The thrust of the article is that the following code will not work in C # : The article then goes into some detail about how to use currying and the Y-combinator to get back to `` Anonymous Recursion '' in C # . This is pretty intere... | Does `` Anonymous Recursion '' work in .NET ? It does in Mono |
C_sharp : I have the follow extension method I have been using . I was not aware until recently that EF Core 2.x , by default , performs mixed evaluation , which means that for the things it does n't know how to convert into SQL , it will pull down everything from the database , and then perform the LINQ queries in mem... | EF Core 2.x - IQueryable extension is getting evaluated at the client and not the database |
C_sharp : What could be the purpose of the tilde in this code block ? ^ Operator ( C # Reference ) Visual Studio 2010Binary ^ operators are predefined for the integral types and bool . For integral types , ^ computes the bitwise exclusive-OR of its operands . For bool operands , ^ computes the logical exclusive-or of i... | What is the purpose of the tilde in this situation ? |
C_sharp : Is it possible in C # ( I 'm using .Net 4.5 , but asking more generally ) to determine if two implementations of a generic type are functionally equivalent ? As an example of the need , suppose I have an IMapper interface defined as : My ideal implementation of this is : This would be functionally equivalent ... | Determine type equivalence |
C_sharp : Consider this codeI 'm just taking my database type and converting to MailMessage.It get 's sent in another function . Code analysis tells me I 'm not disposing `` msg '' which is correct . But if I do it here - I get exception when I 'm trying to send it.Also , it complains about not disposing MemoryStream h... | Code analysis complains I 'm not disposing objects . What is wrong here ? |
C_sharp : i am new to this and i am creating simple application in which i click a button and a notification on desktop should be displayed . i am doing this in windows form c # the error is `` NullReferenceException was unhandledi have one button Notify in form1 . i have tried this : form1.cscode for HTMLPage1.html : ... | desktop notification using javascript in windows form |
C_sharp : I am able to get faces from Live Web Cam as a list of Windows.Media.FaceAnalysis DetectedFace objects . Now I would like to pass these faces to Microsoft Cognitive Services API to detect faces and get the face attributes . How can I do this ? <code> IList < DetectedFace > faces = null ; // Create a VideoFrame... | How to detect face attributes using Microsoft Cognitive service by providing Windows.Media.FaceAnalysis DetectedFace list ? |
C_sharp : What Am I missing ? Error 2 Argument 1 : can not convert from 'System.Func ' to 'System.Collections.Generic.IComparer ' Error 1 The best overloaded method match for 'System.Collections.Generic.List.Sort ( System.Collections.Generic.IComparer ) ' has some invalid argumentsWhen I haveit works fine . Are they no... | About list sorting and delegates & lambda expressions Func stuff |
C_sharp : I 'm trying to implement undo functionality with C # delegates . Basically , I 've got an UndoStack that maintains a list of delegates implementing each undo operation . When the user chooses Edit : Undo , this stack pops off the first delegate and runs it . Each operation is responsible for pushing an approp... | C # Lambdas : How *Not* to Defer `` Dereference '' ? |
C_sharp : UPDATE : the next version of C # has a feature under consideration that would directly answer this issue . c.f . answers below.Requirements : App data is stored in arrays-of-structs . There is one AoS for each type of data in the app ( e.g . one for MyStruct1 , another for MyStruct2 , etc ) The structs are cr... | Storing a C # reference to an array of structs and retrieving it - possible without copying ? |
C_sharp : I want to do something like this : This does n't work as written ; is there some minimal workaround to make it work ? Basically I want 0 to chain until non-zero ( or end of chain ) . <code> public override int CompareTo ( Foo rhs ) { return Bar.CompareTo ( rhs.Bar ) ? ? Baz.CompareTo ( rhs.Baz ) ? ? Fuz.Compa... | Can I use the coalesce operator on integers to chain CompareTo ? |
C_sharp : Possible Duplicate : What is the difference between String.Empty and “ ” Which of the following should I use for assigning an empty string and why ? or <code> string variableName = `` '' ; string variableName = string.Empty ; | Which should I use for empty string and why ? |
C_sharp : I do n't get it . The As operator : Then why does the following work ? Baby is a struct , creating it will put value in stack . There is no reference involve here.There are certainly no nullable types here.Any explanation as to why I 'm wrong ? <code> struct Baby : ILive { public int Foo { get ; set ; } publi... | The as operator on structures ? |
C_sharp : I have the following class declaration : I have an Html helper method : This is my ASP.NET MVC ascx : When I pass in an IQueryable collection to the ascx , I get this error : Compiler Error Message : CS1928 : 'System.Web.Mvc.HtmlHelper > ' does not contain a definition for 'TagCloud ' and the best extension m... | Why does n't c # support an object with an interface as a parameter ? |
C_sharp : I was going through a website I 've taken over and came across this section in one of the pages : Apparently anyone who has ever used the site without javascript would not be able to log out properly ( surprisingly enough , this has never come up ) .So the first thing that comes to mind isThen I realized I do... | Why use window.location in a hyperlink ? |
C_sharp : Here 's an example : In the VS2008 output window this shows : A first chance exception of type 'System.ArgumentException ' occurred in System.Drawing.dll Additional information : Parameter is not valid . ( pic http : //i.imgur.com/nM2oNm1.png ) This is on Windows 7.Documentation herehttps : //msdn.microsoft.c... | Why does setting LinearGradientBrush.WrapMode to Clamp fail with ArgumentException ( `` parameter is not valid '' ) ? |
C_sharp : I just installed the fresh released Community Edition of Visual Studio 2015 ( RTM ) and I 'm trying to get my open source project working under VS2015 and C # 6.0 . Some of my .cs are shared across projects . This way I 'm able to build both a PCL version ( with limited functionality ) and a 'full ' version o... | Visual Studio 2015 / C # 6 / Roslyn ca n't compile XML comments in PCL project |
C_sharp : Apologies if this seems a simple question , but I mostly just want to check that the solution I have is the most sensible/holds for all cases.The pre-existing SQL Server database we work with stores a 'period ' as inclusive start - > inclusive end UTC DateTime values . ( Both start & end columns are datetime2... | What is the neatest way to find the last possible instant of a LocalDate , in a particular time-zone ? |
C_sharp : Consider this basic implementation of the maybe monad : Its purpose is to handle a chain of functions returning optional values in a clean way : In the above case both GetOrder and GetClient return a Maybe < T > , but handling of the None case is hidden inside Bind . So far so good.But how would I bind a Mayb... | How do I do a monadic bind to an async function ? |
C_sharp : I have an extension method likeAnd I have two classesandI call RemoveDetail from an Action accepted by method public static void Foreach < T > ( this IEnumerable < T > source , Action < T > action ) ; : ReSharper suggest me to replace this call with method group likeThis worked fine in VS2013 and previous but... | Visual Studio 2015 extension method call as method group |
C_sharp : I have a list of objects that have a property Rank . This is an integer.I want to sort by rank on my view but when i do this : i get all of the zeros ( meaning these have n't been set at the top ) I want to order by 1 -- > n but have the zeros be at the bottom of the list.I would like it to be as efficient a ... | How can I sort but put zeros at the bottom ? |
C_sharp : I 'm developping a webapplication . For the security of the users information i need a https connection . I 'm developping this local at the moment . I have followed the tutorial on : http : //weblogs.asp.net/dwahlin/archive/2009/08/25/requiring-ssl-for-asp-net-mvc-controllers.aspxWhen I build my project the ... | How to use https in c # ? |
C_sharp : Is it somehow possible to set alternate names for querystring parameters in ASP.NET MVC ? I have this simple controller Index action : Calling http : //mysite.com/mypage/ ? color=yellow works quite nicely , the color parameter automatically picks up its value `` yellow '' from the querystring.But now I would ... | Alternate names for querystring parameters |
C_sharp : Broken code The code above is expecting to express : The conclusion infers the premise because of the premise implies the conclusion . The the premise implies the conclusion because of the conclusion infers the premise . It would be circular reasoning , and definitely will cause stack overflow . I then redesi... | Informal fallacy causes stack overflow |
C_sharp : I am trying to create a parallel event subscriber . This is my first attempt : In your expert opinion , is this a valid approach ? Could you please suggest any improvements ? PS : Maybe : would be better ? <code> using System ; using System.Collections.Generic ; using System.Threading.Tasks ; using EventStore... | parallel event subscriber .net 4.5 |
C_sharp : I have a C # .Net 4.0 Application on the one hand and on the other a VB6 App . I created a COM Interface by making the Project COM Visible and actived register COM Interop.I Tested the COM interface by implementing a C # Application wich imports the new tlb file . All seems to be fine . As next step I tried t... | COM class visibility : C # to VB6 |
C_sharp : I think so . But take a look at a built-in class in ASP.NET : Suppose I have an instance of HttpPostedFile called file . Since there is no Dispose method to explicitly invoke , file.InputStream.Dispose ( ) wo n't be invoked until it 's destructed , which I think goes against the original intention of IDisposa... | Should we implement IDisposable if one member is IDisposable |
C_sharp : With a generic List , what is the quickest way to check if an item with a certain condition exists , and if it exist , select it , without searching twice through the list : For Example : <code> if ( list.Exists ( item = > item == ... ) ) { item = list.Find ( item = > item == ... ) ... . } | Checking for item in Generic List before using it |
C_sharp : The SituationWe are selling a Windows Forms Application to customers all over the world.We installed it in several countries in Europe and America . No problems.Last week we installed our software in South-Korea and recognized a strange behaviour ... The problem occurs only on the customers office PCs , but o... | Wrong scaling on Korean PCs |
C_sharp : The following code using LINQ in NHibernate returns a different result from in-memory LINQ and EF LINQ . What is the correct way to do this in NHibernate ? It is fine to use QueryOver if the LINQ version is indeed broken.Expected resultsActual resultsLogged SQLThe full code is in the bug report Incorrect resu... | How to query the first entry in each group in NHibernate |
C_sharp : I have mainly worked in C++ and I am now using C # at my new job , and after doing some reading on here about the 'ref ' keyword and c # value vs reference types I am still finding some confusion with them.As far as I 'm understanding these if you were passing these to a method these would be analogous C++ st... | Use of C # 'ref ' keyword compared to C++ |
C_sharp : I have this COM method signature , declared in C # : I call it like this : Does the .NET interop layer first copy the whole array to a temporary unmanaged memory buffer , then copy it back ? Or does the array get automatically pinned and passed by reference ? For the sake of trying , I did this in the COM obj... | Does .NET interop copy array data back and forth , or does it pin the array ? |
C_sharp : Using c # Web Api 2 , I have code that throws an InvalidOperationException . When returning a status code of 302 , how do provide a location for the redirect using the HandleException annotation ? Edit : Sorry , I asked this question in a bit of haste . The above class uses a HandleExceptionAttribute class wh... | How do you specify the location when using handleexeption annotation for a 302 status code |
C_sharp : When should locks be used ? Only when modifying data or when accessing it as well ? Should there be a lock around the the entire block or is it ok to just add it to the actual modification ? My understanding is that there still could be some race condition where one call might not have found it and started to... | locking only when modifying vs entire method |
C_sharp : I have a class similar to : I then created a method to pull the names from the class.So when I get my array it would be in the following order : I was wondering if it was possible to change the order so that the base class fields were first followed by the derived class fields ? <code> public class MyClass : ... | How to get a list of property names in a class in certain a order |
C_sharp : This may seem a little crazy , but it 's an approach I 'm considering as part of a larger library , if I can be reasonably certain that it 's not going to cause weird behavior.The approach : Run async user code with a SynchronizationContext that dispatches to a thread pool . The user code would look something... | Multiplexing C # 5.0 's async over a thread pool -- thread safe ? |
C_sharp : Expected end results is to get an IEnumerable with 1.2 , 2.3 , 3.1 , 4.2 which represents the SubTierId of each subTier.but what happens is I get this return type . What is the best way so that I just get a single IEnumerable of the SubSubTier ? <code> Top Tier Object SubTier Objects SubSubTier Objects 1.1,1.... | How to get Sub objects based on value using linq ? |
C_sharp : I ran into what I think is a really odd situation with entity framework . Basically , if I update an row directly with a sql command , when I retrive that row through linq it does n't have the updated information . Please see the below example for more information.First I created a simple DB tableThen I creat... | Unexpected behavior in entity framework |
C_sharp : I just came across a strange behavior with using async methods in structures . Can somebody explain why this is happening and most importantly if there is a workaround ? Here is a simple test structure just for the sake of a demonstration of the problemNow , let 's use the structure and do the following calls... | Struct 's private field value is not updated using an async method |
C_sharp : I had read data from an XML file into DataSet by using c # than I want to identify duplicate ( completely the same ) rows in that set.I tried such kind of grouping and that works ! But the number of data columns can be differ , so I can not apply static grouping in query like above . I had to generate the gro... | Query to detect duplicate rows |
C_sharp : Could you please explain me the reason of the following situation.Today I wrote the code ( only variables names are changed ) : Everything was fine until I decided to move the if condition to a variable : Now the compiler underlines firstInteger and secondInteger variables with error `` Local variable might n... | Moving `` if '' statement condition to a local variable makes C # compiler unhappy |
C_sharp : I have a business layer class that uses System.IO.File to read information from various files . In order to unit test this class I 've chosen to replace the dependency on the File class with an injected dependency like so : Now I can test my class using a Mock and all is right with the world . Separately , I ... | How do I ( or do I ) unit test a concrete dependency |
C_sharp : For EF6 , I had a method in my generic repository that I exposed to all service layers in order to retrieve entities from the database with any nested properties as needed : This way , I could use the method in the following way : In EF6 , this would load the Papers navigation property , the People navigation... | Translating generic eager load method from EF6 to EF Core |
C_sharp : This piece of code caught me out today : clientFile.Review month is a byte ? and its value , in the failing case , is null.The expected result type is string.The exception is in this codeThe right hand side of the evaluation is being evaluated and then implicitly converted to a string.But my question is why i... | C # Ternary Operator evaluating when it should n't |
C_sharp : I 've just upgraded to VS2015.1 and got a compiler crash when trying to compile one of my projects . If you put the following repo code in a console application ( and add a reference to moq.dll ) the code in line 12 crashes my compiler . It seems to happen during a Roslyn lamdba rewrite call.Anyone know why t... | Why does Roslyn crash when trying to rewrite this lambda ? ( Visual Studio 2015 update 1 ) |
C_sharp : Updated with a solution that works for me . See the bottom of this question.Context : I needed a way to evaluate the size of a generic type for the purpose of calculating array lengths to fit within a certain byte size . Basically , sizeof similar to what C/C++ provides.C # 's sizeof and Marshal.SizeOf are no... | Using assemblies compiled from IL with .NET Core & Xamarin |
C_sharp : Ok , consider the following code : trueOrFalse is a compile time constant and as such , the compiler warns correctly that int hash = o.GetHashCode ( ) ; is not reachable.Also , constObject is a compile time constant and as such the compiler warns again correctly that int hash = o.GetHashCode ( ) ; is not reac... | Compile time constants and reference types |
C_sharp : I have these statements and their ' results are near them.Why the last equality gives me false ? The question is why ( x == y ) is true ( k == m ) is false <code> string a = `` abc '' ; string b = `` abc '' ; Console.Writeline ( a == b ) ; //trueobject x = a ; object y = b ; Console.Writeline ( x == y ) ; // ... | Object equality behaves different in .NET |
C_sharp : Hello I want to scan audio-video files and store their metadata in a database using php . I found this Command-line wrapper that uses TagLib.dll compiled by banshee developpers to do the job . It 's works fine but it limited by the functions implemented . I want to access directly to the dll methods via PHP.I... | Build TagLib # DLL from source and make it COM Visible to PHP |
C_sharp : The following code : might be optimized toif x gets assigned in another thread only . See Illustrating usage of the volatile keyword in C # . The answer there solves this by setting x to be volatile.However , it looks like that is not the correct way to go about it according to these three contributors ( with... | Prevent bad-optimization in Multithreading |
C_sharp : Input in my case is a string with a list of elements separated by CommaInput : Expected Output ( a string ) : I 'm looking for a solution in VB.net but i 'm not so familiar with it . So , I tried it in c # . Not sure what i 'm missing . My Attempt : Actual Output : Any help in funding a solution in vb.net is ... | Appending a Char to each element in a array |
C_sharp : I want to be able to specify something like this : Class FilterControl < > is a base class . I can not know what will be the generic argument for FilterControl < > . <code> public abstract class ColumnFilter < TCell , TFilterControl > : ColumnFilter where TFilterControl : FilterControl < > , new ( ) where TCe... | Generic type in generic constraint |
C_sharp : I 'm using specifications in this kind of form : Now I can use this specification in the form : But I 'm not sure how to use the specification against an associated object like this : Is there a way to do this , or do I need to rethink my implementation of specifications ? <code> public static Expression < Fu... | Linq : how to use specifications against associated objects |
C_sharp : Im making a graph program and im stuck at where I need to get mouse coordinates to equal graphic scale . With picturebox I use transform to scale my graphic : Im using MouseMove function . Is there a way to transform mouse coordinates ? When I put my mouse on x=9 I need my mouse coordinate to be 9 . <code> Re... | Transforming mouse coordinates |
C_sharp : What is better : to have large code area in lock statementorto have small locks in large area ? ..exchanges in this sample are not changable . or <code> lock ( padLock ) { foreach ( string ex in exchanges ) { sub.Add ( x.ID , new Subscription ( ch , queue.QueueName , true ) ) ; ... ... ... } foreach ( string ... | What is the proper way to lock code areas |
C_sharp : I have an NUnit unit test which I have two collections of different types which I want to assert are equivalent.where Assert.IsPrettySimilar is defined like suchMy question is , is there a more idiomatic way of doing the above with the existing methods in NUnit ? I already looked at CollectionAssert and there... | Assert two different types of enumerations are equivalent |
C_sharp : I am a new ASP.NET developer and I am developing a web-based application in which there is a menu bar that has many options . Some of these options will be displayed only to the Admin . There is a logic behind the system to check whether the user is an admin or not . If yes , the options will be displayed . I... | How to remove the sql injection from this query and make it working well ? |
C_sharp : I am stepping through the WPF source code to debug some issue with my own code . I have the source and the pdb 's ( I 'm using dotpeek as a symbol server so I have the full pdbs with source code ) and I can step into the WPF code no problem . The modules I am interested in are PresentationFramework and System... | How to temporarily stop optimisation of WPF framework elements ? |
C_sharp : I have a regex to match date format with comma . yyyy/mm/dd or yyyy/mmFor example : 2016/09/02,2016/08,2016/09/30My code : I use option multiline.If string data have `` \n '' .Any character will match this regex.For example : I find option definition in MSDN . It says : It changes the interpretation of the ^ ... | Regex option `` Multiline '' |
C_sharp : I have 5 numbers i.e . : 1 1 1 2 3 ; I have to sum them except the minimum number , but I can remove it only one time ( if the minimum occurs more than one time I have to maintain the rest ) . How can I do it with Linq ? I thought : But it remove all the 1s from the lists . I need a way to go out from the whe... | Linq remove only one item if there are duplicate |
C_sharp : Is there any way to find a path in C # dynamically without executing `` where '' command prompt command ? For example , if I want to find mspaint exe , I can type this in command promptand it returns the path . <code> where mspaint | Equivalent of `` where '' command prompt command in C # |
C_sharp : I just hit a situation where a method dispatch was ambiguous and wondered if anyone could explain on what basis the compiler ( .NET 4.0.30319 ) chooses what overload to callIn any case , why does the compiler not warn me or even why does it compile ? Thank you very much for any answers . <code> interface Ifac... | c # Generic overloaded method dispatching ambiguous |
C_sharp : This question is about this code : I answered this question yesterday and if you notice in the comments to the question ( not the answer ) , one of the members @ gertarnold said this : entityEntry.Property ( `` InsertedBy '' ) does n't use reflection , it reads the EF metadata . Sure it uses the EF metadata t... | Does the Entity Framework DbEntityEntry.Property method use reflection ? |
C_sharp : I have a Mailchimp RSS campaign that reads an RSS feed on a website and is set to once a day . I would like to send this campaign pro-grammatically after I add an item to the feed.I am using PerceptiveMCAPI and My code for triggering the campaign isThe error I receive looks likeAny ideas on what would be caus... | Mailchimp Campaign Send Error - This Campaign has already been sent and can not be sent again |
C_sharp : The following code will throw an exception : This seems like strange behavior to me , can someone explain why this is n't a bug ? Or perhaps suggest a workaround ? Instantiating a Regex object in place of the null will of course stop this from throwing an exception.The exception produced is : Newtonsoft.Json.... | Deserialize null regex property with json.net |
C_sharp : The language I use is C # .Let we have a List of objects of type T , Say that we want to go over each item of collection . That can be done in many ways . Among of them , are the following two : andDoes the second way be better than the first or not and why ? Thanks in advance for your answers . <code> List <... | faster way between to ways of iterating through all the elements of a collection in C # |
C_sharp : I have this interface that is being used by a handful of concrete types , such as EmailFormatter , TextMessageFormatter etc.The issue I 'm having is that with my EmailNotificationService is that I want to inject EmailFormatter . The constructor signature for this service is public EmailNotificationService ( I... | How to inject proper dependency based on constructor parameter name |
C_sharp : I am trying to understand how ASP.NET MVC works and I have been recommended to follow the MVC Music Store Tutorial , however I am having problems since I am using different ( more current ) software.According to this page I should add a List of genres to my action method inside my StoreController.cs . However... | Is this deprecated way of coding ? ASP.Net MVC |
C_sharp : I 've imported Microsoft.VisualStudio.Threading into .Net Core Web App . I did this specifically to make use of AsyncLazy < T > .I wanted to make sure I did this right , so I imported the appropriate Analyzers.The warnings and the documentation clearly state that a JoinableTaskFactory should be injected into ... | Do I use a JoinableTaskFactory with AspNetCore ? |
C_sharp : So I want to execute PowerShell Calculated Properties ( I hope that 's the correct name ) from C # .My CmdLet in the PS ( Exchange ) Console looks like this : This works just fine , the problem occures when I try to execute it from C # .My Code looks like this : My result then contains the empty ToBeExpandedG... | Using PowerShell Calculated Properties from C # |
C_sharp : I am confused by some code that should n't be working , but oddly enough , is working and I know I 'm simply overlooking something obvious . I 'm looking at the source code for the Accord.NET framework and I downloaded it and its compiling just fine , but I 'm confused about something . In one of the assembli... | Accessing an internal class from a different Dll file |
C_sharp : From the docs for the TakeUntil operator ( emphasis mine ) : The TakeUntil subscribes and begins mirroring the source Observable . It also monitors a second Observable that you provide . If this second Observable emits an item or sends a termination notification , the Observable returned by TakeUntil stops mi... | TakeUntil not working as documented ? |
C_sharp : I 'm developing a multi-tenant application in ASP.NET Core 2.1 . I 'm utilizing AspNetCore.Identity.EntityFrameworkCore framework for user management . I want to add a unique index combining NormalizedName with TenantId in Role Table . Also , in the user table NormalizedUserName with TenantId in User table . ... | Override default indexes in AspNetCore.Identity tables |
C_sharp : FsCheck has some neat default Arbitrary types to generate test data . However what if one of my test dates depends on another ? For instance , consider the property of string.Substring ( ) that a resulting substring can never be longer than the input string : Although the implementation of Substring certainly... | FsCheck : How to generate test data that depends on other test data ? |
C_sharp : I am trying to insert millisecond into data type of datetime ( 6 ) in MySQL using c # .here is my code : the createtiming is created withI have read the value of createtiming before it inserts into MySQL , and it does contain milliseconds , however , when I do on MySQL , I only see time like While the time sh... | inserting millisecond into mysql from c # |
C_sharp : I would expect `` 2- '' and `` 22 '' to always compare the same way , but changing the 3rd character changes the sort order . What on earth is happening here ? Our culture is en-US by the way . <code> string.Compare ( `` 2-1 '' , '' 22- '' , StringComparison.CurrentCulture ) //-1string.Compare ( `` 2-2 '' , '... | Character after hyphen affects string.compare |
C_sharp : I am using Visual Studio and I am very confused about the best way to store configuration strings . I am creating a Windows Forms Application . I need very basic security -- I do n't want the password to be readable in app.config but I am not concerned about someone disassembling my code in order to figure it... | Proper Storage of Configuration Strings |
C_sharp : ProblemProblem shapingImage sequence position and size are fixed and known beforehand ( it 's not scaled ) . It will be quite short , maximum of 20 frames and in a closed loop . I want to verify ( event driven by button click ) , that I have seen it before . Lets say I have some image sequence , like : http :... | Verify image sequence |
C_sharp : I been scratching my head trying to figure out why a project I have ( what I did not touch ) was not working anymore.Basically I was trying trying to get some data back from google contacts . When I selected `` allow '' in the oAuth part it would keep giving me a 404 error . This is all done in the windows ph... | Google Api Redirect gives me 404 error on WP7 When using Windows 8 but not Windows 7 |
C_sharp : I am currently writing a resource manager for my game . This is basically a class that will handle all kinds of other objects of different types , and each object is referred to by name ( a System.String ) . Now this is my current implementation , but since I am using a dictionary of objects I will still need... | Dictionary using generics |
C_sharp : The below code works fine : Whereas the below code wo n't compile : In the second example the compiler says that i am trying to set a property on a variable that has not been instantiated . In either case lstMyControl must be instantiated , but the compilr ca n't seem to follow that code paths through the swi... | Why ca n't C # compiler follow all code paths through a switch statement |
C_sharp : Is there a way to do what classmethod does in Python in C # ? That is , a static function that would get a Type object as an ( implicit ) parameter according to whichever subclass it 's used from.An example of what I want , approximately , isthe expected output being ( same code on codepad here . ) <code> cla... | Python-style classmethod for C # ? |
C_sharp : I want to calculate the mean absolute deviation and I 'm currently using the following class from Stack Overflow ( link here ) , posted by Alex : The person who made that class , did it somehow weirdly and I do n't understand the calculations , because he 's using different formulas . For example , people nor... | Calculating mean absolute deviation |
C_sharp : While trying to organize some data access code using EF Core I noticed that the generated queries were worse than before , they now queried columns that were not needed . The basic query is just selecting from one table and mapping a subset of columns to a DTO . But after rewriting it now all columns are fetc... | EF Core queries all columns in SQL when mapping to object in Select |
C_sharp : Probably a silly question , since I may have already answered my question , but I just want to be sure that I 'm not missing something Constant expressions are evaluated at compile time within checked context . I thought the following expression should n't be evaluated at compile time , since I assumed C # co... | It appears some parts of an expression may be evaluated at compile-time , while other parts at run-time |
C_sharp : Transparent images are pure evil in Windows Forms , that why I 've created a custom control class to handle them . The designer does n't show my control when it 's empty . I would like to add a subtle border , but only in the design view ( and when no border is added by the user ) . How would I do this ? My c... | How to add a border to a custom control in the design view ? |
C_sharp : This is not a question about how to change the font size . Rather , why is the size of my font changing by itself as I type ( or paste ) when it 's inside a plain TextBox control which , as you should know , only supports one color , one font , and one font size at any given time.My code : The font is set at ... | Why do multiple font sizes display inside Plain TextBox ? |
C_sharp : I would like to create list of data in list of data . I believe this can be difficult to explain but I will try explain my problem very clear . I created list of data but in this list some arguments are also list of data . I have to write using this code because this are restriction ( Our Factory ) . If I tak... | List in list ( Model ) Factory |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.