text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : I have the below which calculates the running total for a customer account status , however he first value is always added to itself and I 'm not sure why - though I suspect I 've missed something obvious : Which outputs : Where the 309.60 of the first row should be simply 154.80 What have I done wrong ? EDIT... | Linq running total 1st value added to itself |
C_sharp : Why does n't the C # compiler tell me that this piece of code is invalid ? The call to MyMethod fails at runtime because I am trying to call a non-static method from a static method . That is very reasonable , but why does n't the compiler consider this an error at compile time ? The following will not compil... | Why does n't the c # compiler check `` staticness '' of the method at call sites with a dynamic argument ? |
C_sharp : I 'm trying to figure out a way to structure my data so that it is model bindable . My Issue is that I have to create a query filter which can represent multiple expressions in data.For example : x = > ( x.someProperty == true & & x.someOtherProperty == false ) || x.UserId == 2x = > ( x.someProperty & & x.ano... | Polymorphic Model Bindable Expression Trees Resolver |
C_sharp : Is there an easy way to find lines that consist of date time.So far I can read the textfile and my next step is to parse it , but before that I think I need some guidance before I proceed . Here is my current read script : Here is the sample text template that I need to parse generated from the tool.And here ... | Reading text file and get line with date values |
C_sharp : If I have code like this : Is this any slower than ? If so , why ? In the second example , is the compiler generally making a variable from the GetString ( ) ; method which returns a string ? Also , what is the benefit of declaring variables as late as possible ? Does this benefit the GC ? If so , how ( I 'm ... | Declaring variables as late as possible and passing returning method as a parameter |
C_sharp : Alright , so I 've done some research into this topic and most of the solutions I 've found claim to fix the problem but I am finding that they are n't quite working right . I 'm in the early stages of implementing just a simple little particle engine , nothing crazy I 'm just doing it out of boredom . I have... | Flicker in C # WinForms program on screen clear |
C_sharp : I 'm trying to diff two strings by phrase , similar to the way that StackOverflow diffs the two strings on the version edits page . What would be an algorithm to do this ? Are there gems , or other standard libraries that accomplish this ? EDIT : I 've seen other diffing algorithms ( Differ with Ruby ) and th... | What is an Algorithm to Diff the Two Strings in the Same Way that SO Does on the Version Page ? |
C_sharp : Following the MVVM pattern I 'm trying to wire up the display of a child window by the View in response to a request from the View Model.Using the MVVM-Light Messenger the View will Register for the request to display the child window in the constructor of the View as so : Does subscribing to the ChildWindow ... | Will this coding style result in a memory leak |
C_sharp : If numeric expression contains operands ( constants and variables ) of different numeric types , are operands promoted to larger types according to the following rules : if operands are of types byte , sbyte , char , short , ushort , they get converted to int typeIf one of the operands is int , then all opera... | Are operands inside an expression promoted to larger types according to the following rules ? |
C_sharp : I have a query that should return a sum of total hours reported for the current week.This code below returns the Correct total of hours but not for a specific user in the database.The first method returns the number 24 , wich is correct but as i said , not for a specific user.I am trying to do this , but it g... | Linq Query , messed up where clause in method |
C_sharp : I 'm currently reading a book on C # programming and it has brief intro to Overflow and Underflow and the writer gives a general idea of what happens when you go over the allowed range of a certain type.Example So the short type only has a range of from -32768 to 32767 and in the book the explanation given by... | Can someone explain overflow in C # using binary ? |
C_sharp : I tried to use FileInfo.CreationTime , but it does n't represent the copy finish time.I am trying to get a list of files in a directory . The problem is that the call also returns files which are not yet finished copying.If I try to use the file , it returns an error stating that the file is in use.How can yo... | querying a directory for files that are complete ( not copy-in-progress ) |
C_sharp : MonoDevelop suggests turning this : into this : It also does it when I set anotherBoolVar to false instead : becomes : Can someone explain how these statements are equal ? <code> if ( someBoolVar ) anotherBoolVar = true ; anotherBoolVar |= someBoolVar ; if ( someBoolVar ) anotherBoolVar = false ; anotherBoolV... | MonoDevelop suggests turning if statements into bitwise operations |
C_sharp : I am having a ValueConverter used for binding 'To ' Value in a StoryBoard animation , similar to the answer - WPF animation : binding to the “ To ” attribute of storyboard animation.The problem is I am repeating the below piece of code for MultiBinding ValueConverter in couple of places.I want to remove this ... | Storing ValueConverter to variable |
C_sharp : I 'm trying to parse an incoming stream of bytes that represents messages.I need to split the stream and create a message structure for each part.A message always starts with a 0x81 ( BOM ) and ends with a 0x82 ( EOM ) .The data part is escaped using an escape byte 0x1B ( ESC ) : Anytime a byte in the data pa... | Rx.Net Message Parser |
C_sharp : Here is how my last interview went : Question : Where are strings stored ? Answer : Heap since it is a reference typeQuestion : Explain me this following code : Answer : Drew two diagrams like below : ( represents the statement , string two = one ; ( represents the statement , one = one + `` string '' ; . A n... | Strings vs classes when both are reference types |
C_sharp : I 've created a custom structure for handling RGBA values that will be marshaled to the GPU.In my type , I am holding individual R , G , B and A components as byte values and am overlapping a 32-bit unsigned integer ( Uint32 ) to easily pass and assign the packed value . I know the concept is obvious but here... | Seeking optimal way to handle constructors of struct with overlapping fields |
C_sharp : Suppose I have the following two classes.How can I know if a specific property is a Father property ( Inherited ) or a Child property ? I tried but seems like Except is not detecting the equality of Father properties and Child inherited properties . <code> public class Father { public int Id { get ; set ; } p... | How to exclude properties of father class |
C_sharp : I 'm trying to do below where condition is true , I want to execute WHERE else no.Above code giving me error , Type of conditional expression can not be determined because there is no implicit conversion between 'lambda expression ' and 'bool ' <code> var condition = true ; var mast = new List < Master > { ne... | how to put conditional WHERE clause within LINQ query |
C_sharp : Good afternoon , I have been working on a dll that can use CORBA to communicate to an application that is network aware . The code works fine if I run it as a C++ console application . However , I have gotten stuck on exporting the methods as a dll . The methods seems to export fine , and if I call a method w... | PInvoke Unbalances the stack |
C_sharp : I 'd like to replace the character `` by a space in a string in C # .But I have an issue when writing the function : The first argument seems to be an issue.Any idea <code> myString.Replace ( `` '' '' , '' `` ) | Replace character `` in C # |
C_sharp : I am getting an error when I attempt to display a datetime value in a textbox : My code is : The error message is : ex.Message = `` Unable to cast object of type 'System.DateTime ' to type 'System.String ' . `` Any ideas how I can resolve this ? <code> txtStartDate.Text = rdrGetUserInfo.IsDBNull ( 14 ) ? Stri... | Error converting datetime to string |
C_sharp : When using ReactiveExtension Observer exceptions are not being caught by the onError action . Using the example code below instead of the exception being caught `` An unhandled exception of type 'System.ApplicationException ' occurred in System.Reactive.Core.dll '' and the application terminates . The excepti... | .NET ReactiveExtension observer is n't catching errors in OnError |
C_sharp : Given a list of MethodDeclarationSyntax I would like to collect all the methods in a solution that are calling this method transitively.I have been using the following code : The problem is that MethodDeclarationSyntax does n't seem to be a singleton , so this loop is running forever , visiting the same metho... | How to collect all MethodDeclarationSyntax transitively with Roslyn ? |
C_sharp : I 've tried to set up a small demo , in which an article has multiple comments . The article details view , should render the comments in a partial view . The partialView itself contains another partial view for adding a new comment . When I try to add another comment I receive a InsufficientExecutionStackExc... | Why does the PartialView keep calling itself ? |
C_sharp : I need to validate that the user entered text in the format : Can I do this using Regex.Match ? <code> # # # # - # # # # # - # # # # - # # # | C # regex help - validating input |
C_sharp : Here it is returning same result . Now when I 'm using StringBuilder it is not returning same value . What is the underneath reason ? Edit1 : My above question answered below . But during this discussion what we find out StringBuilder does n't have any override Equals method in its implementation . So when we... | Why object.Equals and instanceobject.Equals are not same |
C_sharp : I come from a VB.Net environment , where using Imports System and then IO.Directory.GetFiles ( ... ) works.On the other hand , it seems that using System ; is not sufficient to write use IO.Directory without prefixing it with System.. The only workaround seems to be using IO = System.IO ; Why ? Example code :... | Why ca n't I write IO.Directory.GetFiles ? |
C_sharp : Take this example : Why is the implicit implementation of IFoo Bar ( ) necessary even though Foo converts to IFoo without a cast ? <code> public interface IFoo { IFoo Bar ( ) ; } public class Foo : IFoo { public Foo Bar ( ) { // ... } IFoo IFoo.Bar ( ) { return Bar ( ) ; } //Why is this necessary ? } | In C # , why do interface implementations have to implement a another version of a method explicitly ? |
C_sharp : I want to format a typed in time to a specific standard : When the user types it like : `` 09 00 '' , `` 0900 '' , `` 09:00 '' , `` 9 00 '' , `` 9:00 '' But when the user types it like : `` 900 '' or `` 9 '' the system fails to format it , why ? They are default formats I tought . <code> private String CheckT... | FormatException with TryParseExact |
C_sharp : I 'm trying to write an extension method that will convert IDictionary < K , S < V > > holding any type of collection/sequence ( S < V > ) to ILookup < K , V > which is more proper data structure in those cases . This means I 'd like my extension to work on different S types and interfaces : IDictionary < K ,... | Single extension method on IDictionary < K , IEnumerable/IList/ICollection < V > > |
C_sharp : Say I have a method like this : and say I need to detect if the type of arguments is actually an enumeration . I would write something like this : Now , let 's say I need to detect if it 's an enumeration of KeyValuePair ( regardless of the type of the key and the type of the value ) . My instinct would be to... | How to iterate through an enumeration of KeyValuePair without knowing the type of the key and the type of the value |
C_sharp : I have problem to convert this VB code into C # BidEventInfo is a name of classC # code : <code> Public Event SendNewBid As EventHandler ( Of BidEventInfo ) Public event SendNewBid ... . ? ? ? ? ? ? | Convert code from VB into C # |
C_sharp : I 'm trying out Ninject and I 'm modifying to code I wrote with Structure Map to see how easy it is . In this base code I have a graph of objects which have different configurations via the Structure Map registries and the one to use is chosen at runtime via a value in the database ( in this case to pull back... | Using names to discriminate instances using IoC |
C_sharp : I have an abstract base class from which many classes are derived . I want derived classes to be able to override a virtual method defined in the base class , but there is complex logic in the base class that determines whether the overridden method is `` enabled '' at any particular moment.Consider this code... | Is there a better way to call a derived class 's overridden method from its abstract base class ? |
C_sharp : I was working with the first method below , but then I found the second and want to know the difference and which is best.What is the difference between : and <code> from a in this.dataContext.reglementsjoin b in this.dataContext.Clients on a.Id_client equals b.Id select ... from a in this.dataContext.regleme... | The best way to join in Linq |
C_sharp : Before I started using Code Contracts I sometimes ran into fiddlyness relating to parameter validation when using constructor chaining.This is easiest to explain with a ( contrived ) example : I want the Test ( string ) constructor to chain the Test ( int ) constructor , and to do so I use int.Parse ( ) .Of c... | Are code contracts guaranteed to be evaluated before chained constructors are called ? |
C_sharp : This link says that : The @ symbol tells the string constructor to ignore escape characters and line breaks.I try to append contain in StringBuilder like this.But it gives an error in test_all.I got a solution for this using single quotes . ' ' : But I do n't understand as per document why `` `` does not work... | Using @ symbol in string |
C_sharp : My WPF project will be organised like this : To show the Screen1 from the Screen2 I 'll use something like this : ScreenManager.Show ( `` Group1.Screen1 '' ) This looks ( using reflection ) in the Screens.Group1.Screen1 namespace for a View and a ViewModel and instantiates them.How can I eliminate the magic s... | Decouple the screens without magic strings |
C_sharp : I 'm currently in the design phase of multiple rather complex systems which share common functionality ( e.g . both have customer-relationship management ( CRM ) and sales functionality ) . Therefore I 'm trying to extract the common part of the domain and reuse it in both applications . Let 's say I have app... | Can I safely query using the base type of an entity 's proxy interface in NHibernate ? |
C_sharp : I have an enum with custom value for only part of the listWhen I tried strina name = ( MyEnum ) 2 ; name was ThirdValue.But when I changed the enum toIn strina name = ( MyEnum ) 2 ; name was FifthValue.Does the compiler ( I 'm using Visual Studio 2012 ) initialize custom values only if the first has custom va... | Enum with specified values for only some of the members |
C_sharp : Consider this program : Here , an exception of type A is thrown for which there is no handler . In the finally block , an exception of type B is thrown for which there is a handler . Normally , exceptions thrown in finally blocks win , but it 's different for unhandled exceptions.When debugging , the debugger... | Changing an unhandled exception to a handled one in a finally block |
C_sharp : One of the nuget dependencies in my project ( Swashbuckle ) requires a version of the System.Web.Http library ( 4.0.0.0 ) that is older than the version required by the rest of the project ( 5.2.3.0 ) .Swashbuckle requires that I write a class implementing a certain interface : The important part above is the... | C # library which references older version of nuget dependency causes assembly reflection to fail |
C_sharp : I want to be able to match an entire string ( hence the word boundaries ) against a pattern `` ABC '' ( `` ABC '' is just used for convenience , I do n't want to check for equality with a fixed string ) , so newlines are significant to me . However it appears that a single `` \n '' when put at the end of a st... | How to match a string , ignoring ending newline ? |
C_sharp : I used the following in my MVC3 ( aspx ) .NETFramework 4.0 works great . view page extension method : Partial model : In the view : When I updated the application to MVC5 .NETFramework 4.5.1 . First I could not resolve GetDropDownListItems , so I copied it from the extension model to the view using @ function... | SelectListItem / updating application form MVC3 4.0 to MVC5 4.5.1 / view extension method |
C_sharp : I am using c # framework 3.5 ..my class hereI have a listList konumlar ; well , I want to get items that equal their enlem and boylam variables each other..As you see on the photo belowI want to compate enlem and boylam and if its the equal I want to get them to different list..I can do that with a loop but w... | How to get distinct List from a custom list ? |
C_sharp : We are using recursion to find factors and are receiving a StackOverflow exception . We 've read that the C # compiler on x64 computers performs tail call optimizations : JIT definitely does tailcals when running optimized code and not debugging.Running dotnet -- configuration release gets this far in our pro... | Why is tail call optimization not occurring here ? |
C_sharp : Hi there i am new to the repository pattern . I would like to have feedback on the approach i am following.Requirement : Build the menu for the user that is currently logged in . My Solution : I created a Service , that will be called by the controller to get the menu items.The implementation for the serviceT... | Repository pattern for common items |
C_sharp : I have a `` settings '' class , which has some properties for usability and to restrict set accessor . It seems easy while i had within ten items , but then their count was increased . I need some way to create these properties automatically , something like that : It may have deal with reflection , but i ca ... | How to create properties automatically ? |
C_sharp : I have identified that when the following expression is executed : on mysql the query executed is : Can anyone explain please why this last extra condition is added ? AND ( 52 IS NOT NULL ) ) <code> int aNum = 52 ; var myArtifacts = mydbcontext.artifacts.Where ( a = > a.ParentID == aNum ) .ToList ( ) ; SELECT... | Entity framework adds an extra condition on where clause |
C_sharp : I have two classes like thisTrying to mock this in a unit test using Moq with this line new Mock < FooWithGoo < Bar > > ( ) gives me this exception.System.ArgumentException : Type to mock must be an interface or an abstract or non-sealed class . -- - > System.TypeLoadException : Method 'Do ' in type 'Castle.P... | Mocking an abstract class derived from an abstract class |
C_sharp : Where the _Internal is a Service with a guaranteed 99.99 % up-time and not formalized fault contract interfaces defined . Exceptions which are handled in my application level ( business layer level ) as a BusinessException - root class Where BusinessException is defined as followsAnd the current test Method i... | How to add an exception test for the below Http call that returns a json |
C_sharp : Short VersionFor those who do n't have the time to read my reasoning for this question below : Is there any way to enforce a policy of `` new objects only '' or `` existing objects only '' for a method 's parameters ? Long VersionThere are plenty of methods which take objects as parameters , and it does n't m... | Can I detect whether I 've been given a new object as a parameter ? |
C_sharp : I 've been looking quite a bit at Mr. Skeet 's blog on how to re-implement LINQ.In particular , he states that the code : is translated to methods that are extension methods that are provided by the LINQ library : BY THE COMPILER.My question is , how does one impress the bigwigs enough with a library to cause... | Is it possible to create C # language modifications as did LINQ ? |
C_sharp : I 'm using Simple.Data ORM . I 'm trying to make a query from two joined tables . This query works fine : But when this line is added : I 'm getting this exception : The multi-part identifier \ '' dbo.CandidateProfiles.CandidateId\ '' could not be bound.I was trying explicitly pass 0 , 1 and few other numbers... | Simple.Data ORM . The multi-part identifier could not be bound |
C_sharp : If I implement a generic type that risks being instantiated with lots of type params , should I avoid ( for JIT performance/code size etc . reasons ) having many nested non-generic types ? Example : The alternative which works equally well is to have the non-generic types outside , but then they pollute the n... | Should I avoid nested types in generic types ? |
C_sharp : I have a column in a table that is full of regular expressions . I have a string in my code , and I want to find out which regular expressions in that column would match that string and return those rows . Aside from pulling each row and matching the regular expression ( which is costly , checking against pot... | Matching a string against a column full of regular expressions |
C_sharp : I have a variable that indicates the length of time the UI can be idle . I have elected to call this variable UITimer . I want to pass the variable into my classes constructor and then store it off in a local field.What is the proper way to do the casing of this ? We use the common convention of a parameter n... | Capitalization of an acronym that starts a parameter |
C_sharp : I 've seen and used this pattern several times , and it 's very useful for providing common functionality across a series of type-specific subclasses . For instance , this could be a model for Controllers/Presenters specific to a type of domain object that is central to the page ( s ) the class is used to con... | Is there a name for this pattern of using generics ? |
C_sharp : Does code in the constructor add to code in subclass constructors ? Or does the subclass 's constructor override the superclass ? Given this example superclass constructor : ... and this subclass constructor : When an instance of FordCar is created , will this trace `` Car '' and `` Ford '' ? ? Edit : Will ar... | Does code in the constructor add to code in subclass constructors ? |
C_sharp : I am trying to aggregate several queries together to provide a latest updates display for my users using a common data structure for union support . In my first function I have the following select clause : When called this correctly generates a query that returns 9 fields . The second method 's select is : W... | Why is Linq-to-sql incorrectly removing fields in my union ? |
C_sharp : I was wondering why it is possible to do this in C # 7.0 : ..but not this : Can someone explain that ? <code> int ? test = 0 ; int test2 = test ? ? throw new Exception ( `` Error '' ) ; int ? test = 0 ; int test2 = test ? ? return ; | Null coalescing operator ( ? ? ) with return |
C_sharp : I have Net Core 3.1.1000 installed.Now we are trying to run ef migrations with EF Core 2.2.6 database previous Solution , when running the following , receive error below.The application to execute does not exist : .dotnet\tools.store\dotnet-ef\2.2.6-servicing-10079\dotnet-ef\2.2.6-servicing-10079\tools\netco... | Entity Framework : Run EF Migrations for Previous Version in Net Core |
C_sharp : I need to take an 8 bit number on a 64 bit cpu and shift it to the right 8 times . Each time I shift the number I need to shift the same 8 bit number in behind it so that I end up with the same 8 bit number repeating 8 times . This would end up being shift , add 8 , shift add 8 ... etc . which ends up being 4... | Is there a shift and copy cpu instruction that can be accessed from c # ? |
C_sharp : How can I get this in to one query ? What I want is the Person from the Company that matches the name of the person I 'm searching for.Currently I get the Company and then run basically the same search . <code> var existingCompany = bidInfo.Companies .FirstOrDefault ( c= > c.CompanyDomain ! = null & & c.Compa... | How do I combine these two linq queries into a single query ? |
C_sharp : When I 'm running this code , I 'm getting error Index was outside the bounds of the array.Can anyone help me out , please ? <code> for ( var i = 9 ; i + 2 < lines.Length ; i += 3 ) { Items.Add ( new ItemProperties { Item = lines [ i ] , Description = lines [ i + 1 ] , Quantity = lines [ i + 2 ] , UnitPrice =... | Error : Index was outside the bounds of the array |
C_sharp : I have the following classAnd NUnit unit testMy Unit tests fails with When I debug the method return 8.49 so where does the unit test get the long number from with a 2 at the end ? <code> public static class MyClass { public static double Converter ( int mpg ) { return Math.Round ( ( double ) mpg / ( ( double... | C # NUnit unit test not using correct method return to compare |
C_sharp : I have implemented Multi Language Support into my ASP.NET C # followed by this tutorial and set english to my Default language as can be seen here : When switching to german nothing happens : In my App_GlobalResource Folder I have to files : de.language.resx and en.language.resxMy mls.cs file ( In the tutoria... | Switching Language in C # .NET has no impact to site |
C_sharp : Reading through answers to this question prompted me to think about what happens exception-wise when the awaited task throws . Do all `` clients '' get to observe the exception ? I admit I may be confusing a couple of things here ; that 's the reason I 'm asking for clarification.I 'll present a concrete scen... | What happens when multiple parallel threads await the same Task instance which then throws ? |
C_sharp : I have this list in C # : I can easily print the content of the list with : Now I want to do the same in F # ( I understand from over here that a List < T > is similar to a ResizeArray ) : Now the problem is , that in the for-loop word becomes null . What am I doing wrong here ? EDIT : Here is the full code .... | Why ca n't I print this array in F # ? |
C_sharp : I have come across this several times in the last week , and am curious to know the reason - I had a google , but could n't find anything directly relevant.I have a class with a dynamic method , and I can add a static method with the same interface : This is fine , but if I try to call the static method from ... | Method overload static + Dynamic fails |
C_sharp : I was wondering if this code could be improved . The IProvider implements IProvider and overwrites Request ( ... ) . I 'd like to combine these into a single interface . But I still need a typed and untyped interface to work with.Is there a way to combine these where I get both or is this how the interfaces s... | Is it possible to define a non-generic interface which can have generic methods ? |
C_sharp : If it helps , the following question is in the context of a game I am building.In a few different places I have the following scenario . There exists a parent class , for this example called Skill , and I have a number of sub-classes implementing the methods from the parent class . There also exists another p... | What is a correct way of replacing the switch block and Enum in this situation ( C # ) ? |
C_sharp : I have a class that manages collections of objects e.g . List < Car > and List < Bike > which are atribute . I 'd like to find a way to get a reference to each of those collections in a lookup so I can implement methods such as Add < Car > ( myCar ) or Add ( myCar ) ( with reflection ) and it will add it to t... | Implementing a lookup table that takes T and returns attributes on method of type List < T > |
C_sharp : I would like to know the most efficient way of creating new arrays from the content of other arrays.I have several arrays of strings of the type : It would be possible to create now a new array of string in a similar way to this ? That would contain all the strings included in the other arrays . <code> public... | Create new array using content of other arrays in C # |
C_sharp : I want to associate custom data to a Type , and retrieve that data in run-time , blazingly fast.This is just my imagination , of my perfect world : var myInfo = typeof ( MyClass ) .GetMyInformation ( ) ; this would be very fast ... of course this does not exist ! If it did I would not be asking . hehe ; ) Thi... | What is the most efficient performance-wise way of associating information with a 'Type ' object in .Net ? |
C_sharp : I have these classes : Then I have two generic methods with this signature : Now when I create an instance of Data class and call Add methodThe first generic method is used and generic type Data is correctly inferred.But when I call the same method with a more implemented type object instanceI would expect th... | How does type inference work with overloaded generic methods |
C_sharp : We have a complex XML Structure and really a big one ( > 500 MB ) . the XSD of the structure is : This XSDAs we know this is a complex one . and because of size or non-tab deliminator structure , I could n't convert it to a readable better presentation . I want to read this file via C # and search the drug na... | Unstructured XML via non-tab deliminator ? |
C_sharp : I have an ad-hoc reporting system ; I have no compile-time knowledge of the source type of queries or of the required fields . I could write expression trees at runtime using the System.Linq.Expressions.Expression factory methods , and invoke LINQ methods using reflection , but Dynamic LINQ is a simpler solut... | Convert my value type to nullable equivalent |
C_sharp : I am trying to build the source for the .net connector c # in Visual Studio 2017 . I 've tried downloading several versions of the MySQL connector from GitHub ( https : //github.com/mysql/mysql-connector-net/releases ) , but every version has an issue , I 'm not sure what I 'm missing . I tried downloading th... | Opening MySQL.Data source from Github source |
C_sharp : I am collecting data from a USB device and this data has to go to an audio output component . At the moment I am not delivering the data fast enough to avoid clicks in the output signal . So every millisecond counts.At the moment I am collecting the data which is delivered in a byte array of 65536 bytes.The f... | Improve performance of Bitconverter.ToInt16 |
C_sharp : Below is my array : Now in above array , selected property represent check/uncheck status of checkbox and i am posting above array to web service ( WCF ) as string using json.stringify.Above array contains 2000 - 4000 records and now user can check/uncheck checkboxes.Now consider there are 4000 records in abo... | Suggestions on posting huge string to web service |
C_sharp : I 'm trying to get the data for each cells to align correctly with each other , but for one column the contents are not lining up with the others . I 'm not sure why this is , as I have looked over all the default styles and other layout/appearance options and nothing is out of the ordinary . I do n't know if... | Column cell value in datagridview not aligning with others |
C_sharp : Just wondering , does it matter in which sequence the LINQ methods are added ? Eg.and this are completely the same ? Of course I can have all methods tested one by one , but I 'd like to have some general idea about the logic.So : Other than methods like FirstOrDefault ( ) , ToList ( ) and other methods that ... | Sequence of LINQ method of any importance ? |
C_sharp : Here is what I 'm trying to do overall . Just to be clear , this is n't homework or for a contest or anything . Hopefully , I 've made the wording clear enough : ProblemGiven a set of strings in the same format , but where some end in a lowercase letter and some do not , return a set of one of each string tha... | Is there an elegant LINQ solution for SomeButNotAll ( ) ? |
C_sharp : I have this code , I am concerned that it is `` not safe '' I used Dispose ( ) before the using statement end , for me it is slightly illogical , but it works just fine . So , is it safe ? <code> using ( FileStream stream = new FileStream ( SfilePath , FileMode.Open ) ) { try { XmlSerializer deserializer = ne... | What happens if I called Dispose ( ) before using statement end ? |
C_sharp : In our external boundaries that expose WCF services , we convert all internal exceptions to FaultException . This is a manual process which often has minor flaws unique to each implementation . It has been copy/pasted and mindlessly modified ( or forgotten ) for each exposed method . To reduce the errors , I ... | Passing Func < > or similar to PostSharp aspect |
C_sharp : I have an inline lambda expression that I would like to use throughout my application . I just ca n't seem to find a reference on how to do this with more parameters than the element being tested . Here is a quick example of what I currently have.I know the IEnumerable.Where accepts a method with the element ... | Can I use a Method instead of Lambda expression with extra parameters |
C_sharp : I 've stumbled accross this code in production and I think It may be causing us problems.Calling the Instance field twice returns two objects with the same hash code . Is it possible that these objects are different ? My knowledge of the CLI says that they are the same because the hash codes are the same.Can ... | Is the following code a rock solid way of creating objects from a singleton ? |
C_sharp : We can raise event in two ways : and I prefer the last one . It is shorter.My colleagues insist on the first variant.Is there any superiority of the first over the second one ? <code> public event EventHandler MyEvent ; private void DoSomething ( ) { ... var handler = MyEvent ; if ( handler ! = null ) handler... | .NET event raising and NullObject pattern |
C_sharp : I have some Action Attributes that allow parameters . This is how it looks like : Now I want to get rid of the magic string `` GetTerms '' in my Attribute . So I would prefer something like : ( Pseudocode , not working ) Having an additional Property inside my attribute-class and doing `` Method2String '' -Co... | Get action name as string for Attribute-parameter |
C_sharp : I am currently working with json.net ! I know how to deserialize json data and how to map with our class . Now I am eager about some queries ! Suppose my jsonstrings isand my attribute class ( in which i want to deserialize above string ) isNow I am using following code for deserialization . ! And Obviously t... | Is this possible in JSON ? |
C_sharp : I have a design problem I 'd like to solve.I have an interface , lets call it IProtocol , which is implemented by two separate classes . We 're looking at over 600 lines of code here . The vast majority of the stuff they do is the same , except for some specific areas , like DiffStuff ( ) ; Current structure ... | Design Problem - Is Inheritance the right way to simplify this code ? |
C_sharp : I have a method which I 'd like to take all list-like objects in my solution . Before .NET 4.5 , this was simple : However , .NET 4.5 introduced IReadOnlyList < T > , which this method should also apply to.I ca n't just change the signature to take an IReadOnlyList < T > , as there are places where I apply th... | C # overload resolution with IList < T > and IReadOnlyList < T > |
C_sharp : I have one asynchronous method : Let 's say I also have this class : I now want to create a convenience method producing a BitmapSource output , using the asynchronous method above to do the work . I can come up with at least three approaches to do this , but it is not immediately obvious to me which one I sh... | Recommended method signature when returning output from asynchronous method ? |
C_sharp : I 'm trying to test a really simple function . It returns numbers which contain some specified digit . If the first argument is null , it 'll throw ArgumentNullException.Unfortunately , Assert.Throws says , that the expected exception is n't thrown and the test fails . When I 'm trying to debug the test , it ... | Assert.Throws method does n't catch the expected exception |
C_sharp : I 'm currently studying for my MS 70-515 exam . In one of the practices the author implements an interface both implicit as well as explicit . The explicit implementation just calls the implicit implementation . The explicit implementation is just listed without an explanation.Does it make sense to have both ... | Does implementing Interface both implicit and explicit make sense ? |
C_sharp : I am creating an application for a shop , where clients are divided into two groups : receivers and payers.1 ) Many receivers can be related to one same payer.2 ) Payer can be receiver itself , thus he is related to one receiver onlyMy code so far look like this : However I need to let the user create a new p... | How to model this entity |
C_sharp : I have a class that saves logging information to the database ( in an NServiceBus message Handle method ) . Most of the time that logging can be done on a separate thread ( and transaction ) from the main process . But it all needs to be done on the same background thread ( meaning that they have to be done i... | Conditionally run the methods of a class on a separate thread |
C_sharp : I have a small program which creates Excel files from a database table , with Excel 2013 it works all fine , but i Need it now for Excel 2010 and now I get the following exception when i will add the `` Format '' to the NumberFormatLocal ( range.NumberFormatLocal = format ; ) The same exception will come when... | excel 2010 Type Conflict NumberFormat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.