text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : I know that the general guideline for implementing the dispose pattern warns against implementing a virtual Dispose ( ) . However , most often we 're only working with managed resources inside a class and so the full dispose pattern seems like an overkill - i.e . we do n't need a finalizer . In such cases , i... | Is it OK to have a virtual Dispose ( ) method as long as all classes in the hierarchy only use managed resources ? |
C_sharp : The situation I have is likeExcept I actually want j to go through the range 0-radius.length , but skip over i : I 'm wondering if there 's a way to do this that is compact , elegant , efficient , readable , and maybe even correct.How I planned to do it was <code> // radius is an int [ ] for ( int i = 0 ; i <... | Does C # have a nice way of iterating through every integer in a range , minus 1 of them ? |
C_sharp : I am trying one more time to reach out to asp.net experts and hoping to get an answer . I am really stuck here and asking for help . Hopefully , my question will not get down voted , and I could get an answer purely from technical point of view instead of people simply being judgmental on my approach . Earlie... | Identify Label and Button Control in each page of the web project |
C_sharp : This code does not compile : The compile fails stating : Inconsistent accessibility : parameter type Foo is less accessible than method SomeBaseClass.ProcessFoo <code> internal class Foo { } public abstract class SomeBaseClass { protected internal void ProcessFoo ( Foo value ) { // doing something ... } } | Protected Internal method not allowing Internal Class as parameter |
C_sharp : I have two very similar methods : The top one , will not compile , saying it returns IEnumerable rather than IQueryable.Why is this ? Also , I am aware I can add `` AsQueryable ( ) '' on the end and it will work . What difference does that make though ? Any performance hits ? I understand that IQueryable has ... | Why is my LINQ statement returning IEnumerable ? |
C_sharp : Browsing the .NET core source code for System.Linq.Expressions , I found the following code located here : Is there any way that GetGetMethod and GetSetMethod can both return null , as seems to be accounted for here ? Is this dead code ? The C # compiler does n't allow for a property to have no getter and no ... | Can a C # Property ever have no GetMethod and no SetMethod |
C_sharp : Im still pretty new so bear with me on this one , my question ( s ) are not meant to be argumentative or petty but during some reading something struck me as odd.Im under the assumption that when computers were slow and memory was expensive using the correct variable type was much more of a necessity than it ... | Using different numeric variable types |
C_sharp : I have application and I have to use a certificate which requires a pin from prompt window.I have following code.Everything works fine in console application but when I run that code in windows service or console application started from task scheduler then application freezes on that line.No exceptions , no ... | Setting private key in certificate hangs windows service |
C_sharp : Question is simpleis this codesame fast as this codecommon sense tell me that it should be faster to look up the reference in dictionary once and store it somewhere so that it does n't need to be looked up multiple times , but I do n't really know how dictionary works.So is it faster or not ? And why ? <code>... | Is it faster to copy reference to object from dictionary or access it directly from dictionary ? |
C_sharp : I have tested two rescaling functions by applying them on FFT convolution outputs.The first one is collected from this link.Here the problem is incorrect contrast.The second one is collected from this link.Here the output is totally white.So , you can see two of the versions are giving one correct and another... | Rescaling Complex data after FFT Convolution |
C_sharp : I have code like this : Let 's say the LongRunningCalc methods each take 1 second . The code above takes about 2 seconds to run , because while the list of 5 elements is operated on in parallel , the two methods called from the let statements are called sequentially.However , these methods can safely be calle... | How to run LINQ 'let ' statements in parallel ? |
C_sharp : Consider the following two extension methods : When I wrote my second method , I intended it to call the generic LINQ Enumerable.Contains < T > method ( type arguments inferred from the usage ) . However , I found out that it is actually calling the first method ( my custom Contains ( ) extension method . Whe... | Why does the compiler choose overload with IEnumerable over IEnumerable < T > ? |
C_sharp : I have a view model which retrieves an object from some service , and makes it available for data binding . The object is implementing INotifyPropertyChanged . In the view model , I am listening to the PropertyChanged event to perform some internal actions when certain properties in the object are modified.No... | Is unsubscribing from event necessary for an object with shorter lifetime ? |
C_sharp : In C , when compiled to a x86 machine , I would usually replace branches with logical expression , when speed is the most important aspect , even if the conditions are complex , for example , instead ofI will write : Now clearly , this might be a harder to maintain , and less readable code , but it might actu... | Avoiding branches in managed languages |
C_sharp : This is just for academic purpose . I noticed that for integral literals , we can declare up to 18446744073709551615 which is 2^64-1 or ulong.MaxValue . Defining greater than this value produces a compile-time error . And for floating-point literals , we can declare them with integral part up to 999 ... 999 (... | C # compiler does not limit the number of digits of fractional part of a floating-point literal |
C_sharp : I 'm trying to post to a local bitcoin full node via json-rpc but I 'm getting an error from the server.Following the documentation here : https : //bitcoincore.org/en/doc/0.17.0/rpc/rawtransactions/createrawtransaction/I can see the following example structure for a createrawtransaction request : My code cre... | Trouble posting CREATERAWTRANSACTION to Bitcoin Core via JSON-RPC |
C_sharp : Given an enum like this : I am using the following code to give me an IEnumerable : The code works very good however I have to do this for quite a lot of enums . Is there a way I could create a generic way of doing this ? <code> public enum City { London = 1 , Liverpool = 20 , Leeds = 25 } public enum House {... | How can I use Generics to create a way of making an IEnumerable from an enum ? |
C_sharp : I have something like this : Why is Math.Round ( ) rounding even numbers down and odd numbers up ? <code> double d1 = Math.Round ( 88.5 , 0 ) ; // result 88double d2 = Math.Round ( 89.5 , 0 ) ; // result 90 | Rounding up and down by Math Round ( ) |
C_sharp : I am working on a legacy ecommerce platform and have noticed a convention when dealing with credit card numbers . C # or in sqlI presume the reasoning is to remove it from memory before setting it to null which may not remove the value . But that reasoning would seem to suggest that SQL Server and/or the .NET... | Overwrite then set to null |
C_sharp : The following results do n't make any sense to me . It looks like a negative offset is cast to unsigned before addition or subtraction are performed.Although it might seem strange to use negative offsets , there are use cases for it . In my case it was reflecting boundary conditions in a two-dimensional array... | Pointer offset causes overflow |
C_sharp : I have a situation where I need to dynamically build up a list of filters to apply to a list of objects . Those objects can be anything that implements an interface which contains all of the properties I need to filter on.I have a list of criteria defined like so ... and add criteria like so ... I then apply ... | C # generic constraint not working as expected |
C_sharp : I want to build my grammar to accept multiple number . It has a bug when I repeat the number like saying 'twenty-one ' . So I kept reducing my code to find the problem . I reached the following piece of code for the grammar builder : Now when I pronounce `` one one '' it still gives me this exception Which wh... | TargetInvocationException when using SemanticResultKey |
C_sharp : a few months ago I wrote this code because it was the only way I could think to do it ( while learning C # ) , well . How would you do it ? Is unchecked the proper way of doing this ? <code> unchecked //FromArgb takes a 32 bit value , though says it 's signed . Which colors should n't be . { _EditControl.Back... | How to do this without unchecked ? |
C_sharp : My C # code uses impersonation by calling Win32 functions via P/Invokealso I have AppDomain.CurrentDomain.UnhandledException handler installed that also logs all unhandled exception.I 'm sure that the code that logs exceptions works fine both with and without impersonation.Now the problem is that in the above... | Why is exception from impersonated code not caught ? |
C_sharp : I was reading Pulling the switch here and came across this code . Can somoone please explain what is ( ) = > { } and what should I read up to understand that line of code ? <code> var moveMap = new Dictionary < string , Action > ( ) { { `` Up '' , MoveUp } , { `` Down '' , MoveDown } , { `` Left '' , MoveLeft... | What does ( ) = > { } mean ? |
C_sharp : I want to specify that one property in an XML serializable class is an attribute of another property in the class , not of the class itself . Is this possible without creating additional classes ? For example , if I have the following C # classhow can I specify that IsAlertOneEnabled is an attribute of AlertO... | How to specify one property is attribute of another In C # XML serialization ? |
C_sharp : So I have a simple enough console app : I 've built it with release configuration . When I run it and open task manager , I see ithas 4 threads . Why is this happening even though I 'm not creating any threads ? This ca n't possibly be each application . I tried opening notepad and it has just 1 thread . Alth... | Free multiple threads ? |
C_sharp : I have an interface to a .NET service layer , which , in turn , will communicate with a third-party system via a web service . This handles a number of different tasks related to the third-party system 's functionality ( it is actually a bespoke CRM system , but as the context is n't relevant I will swap this... | Generics and convention in C # |
C_sharp : For some reason this statement is working fine : But if at the top of the class , I define an alias ( to save space ) : Then the resulting line of code : Gives me an error : '' Delegate 'System.Func < ValidationMessage , int , bool > ' does not take 1 arguments '' . What 's odd about that is that is n't the D... | Using a type alias in a linq statement is generating an error |
C_sharp : ProblemI currently have a factory that depends on a few parameters to properly decide which object to return . This factory is not yet bound to DI . As I understand it NInject uses providers as a factory.Here is what I currently have . I 'll warn you it 's not pretty.I 'm almost certain this is not the proper... | Dynamically determining dependency based on user parameters |
C_sharp : I 'm trying to understand the yield keyword better and I think I have a decent enough understanding of it so I ran some tests however I was surpised by the results.If I run the below code I get the following output which shows that it loops over the whole range not just up to number 4.Output : If I run the be... | Understanding the yield keyword and LINQ |
C_sharp : Let 's say we have a Foo class : For you to gain perspective , I can say that data in these files has been recorded for about 2 years at frequency of usually several Foo 's every minute.Now : we have a parameter called TimeSpan TrainingPeriod which is about 15 days for example . What I 'd like to accomplish i... | Split an single-use large IEnumerable < T > in half using a condition |
C_sharp : In a lot of TDD tutorials I see code like this : This all makes sense but at some point you are going to get to the class that actually uses MyClass and you want to test that the exception is handled : So why not put the try/catch in MyClass in the first place rather than throwing the exception and have the t... | Unit Testing and Coding Design |
C_sharp : This is more of a why question . Here it goes.C # 7.0 added a new feature called `` Local Function '' . Below is a code snippet.What I dont understand is , its doing a recursive call to the same method . We can easily achieve this with a normal foreach . Then why a local function . MSDN says methods implement... | How is local function in C # 7.0 different from a foreach or a loop ? |
C_sharp : For example I have these two lists : How can I concatenate firstName [ 0 ] and lastName [ 0 ] , firstName [ 1 ] and lastName [ 1 ] , etc and put it in a new list ? <code> List < string > firstName = new List < string > ( ) ; List < string > lastName = new List < string > ( ) ; | Merging 2 Lists |
C_sharp : I ran into this statement in a piece of code : colorList is a list of class System.Drawing.Color.Now the statement is supposed to retrieve the median index of the list .. like the half point of it .. but I ca n't understand how that > > symbol works and how the `` 1 '' is supposed to give the median index .. ... | What does the `` > > '' operator in C # do ? |
C_sharp : I found article stating that recycling and reusing variables is good practice in unity . So I adopted it.But one thing not clear : does this apply to value type variables ( integers , vectors ) ? is there a point i using this : instead of this : <code> int x ; Vector3 v ; void functionCalledVeryOften ( ) { x=... | is there a point in recycling value types unity |
C_sharp : I have a TreeView that is filled with different types of items . The items can either be of type Node ( then they may have children ) or of type Entry ( then they do n't have children ) . For that , I bound my TreeView to my ViewModel property AllNodesAndEntries which is an ObservableCollection < object > . F... | Disable focusability of certain entries in TreeView |
C_sharp : So i convert a float to a string , which is formatted as a currency.But when I want to convert it back to a float , it would n't be possible , because a float cant store the € symbol . So is there a way to convert the string back to a float , but it disregards the `` € '' ( with the space ) ? <code> float f =... | How to parse a string to a float , without the currency format ? |
C_sharp : I am trying to write unit tests for a new project I have created and I 've run into an issue where I ca n't work out how a class that I am intending to write is actually testable . Below I 've simplified the class that I am trying to write to give you an idea of what I am trying to achieve.So I have an XML pa... | Should all classes be testable ? |
C_sharp : Sorry to ask this as I thought I knew the answer , I want to exit the program if userName is greater than 4 characters or userName is not an account called student . However this even if the userName is only 3 characters and is not student I 'm still hitting Application.Exit . What am I doing wrong ? Shame on... | C # simple IF OR question |
C_sharp : An interesting question arose today . Let 's say I have a .NET object that implements a certain interface IMyInterface and is also COM Visible.Now , I load the type from its ProgID and cast to a strongly-typed interface , like so : If I execute the above code , when objEarlyBound.Method ( ) executes , am I ca... | Am I calling a .NET object or a COM object ? |
C_sharp : ExpertsI would like to shuffle windows forms automatically every after 5 mins . windows forms contains Multiple querys , Multiple videos , Multiple powerpoints.I am having three windows forms , as follows.Forms 1 code : Forms 2 : Microsoft Powerpoint filemultiple powerpoint files from network folder ( path ) ... | Auto shuffle between windows forms every after 5 min |
C_sharp : This is not a biggie at all , but something that would be very helpful indeed if resolved . When I 'm overloading methods etc there are times when the xml comments are exactly the same , bar 1 or 2 param names . I have to copy/paste the comments down to each overloaded method , where they are the same . Somet... | Is there a way of referencing the xml comments to avoid duplicating them ? |
C_sharp : We recently updated our applications to make use of SHA-256 code-signing with a new certificate . The assemblies are strong name signed using the Sign the assembly option in Visual Studio 2015 . The post build event in Visual Studio runs two signtool.exe processes to sign both in SHA-256 and for the legacy SH... | Air-gapped .NET code-signed application will not install/run |
C_sharp : So I have this 2 methods which suppose to multiply a 1000 items long array of integers by 2.The first method : The second method : Note that I use this code only for performance research and that 's why it looks so disgusting.The surprising result is that Power is faster by almost 50 % than PowerNoLoop even t... | Weird performance behavior |
C_sharp : Have an app where I would like to upload an image . I am using byte array for this.The image is required but when I put that annotation on the variable and try create an image , it gives me the error message when it should have the image there . It also returns that the Model is Invalid.When I remove the Requ... | Can not make Byte a Required Field |
C_sharp : How does one add a new function to a delegate without using the += notation ? I wonder how to do his from another CLR langage , namely F # . ( I know there are much nicer way to deal with events in F # , but I am being curious.. ) Edit As pointed out by Daniel in the comments , the fact that one has no direct... | Adding delegate in C # |
C_sharp : Given the class below , to launch a splash screen on an alternate thread : This is called and closed with the following respective commands Fine.I am not exactly new to the TPL , of course we can show the form on another thread using something as simple as : My issue is closing this SomeForm down when you are... | TPL Equivalent of Thread Class 'Splash-Type ' Screen |
C_sharp : I am using an expression to identify a specific method in a class , and return the attribute of the method . When the method is async , the compiler gives me a warning that the method should be awaited.Are there any other ways I could identify the method , or any way to suppress the warning , without using pr... | Expressions to identify async methods causes compiler warning |
C_sharp : I 'm porting a Win8.1 app to UWP for Win10 and experiencing a strange issue with the AppBar . We 've tried using CommandBar instead of AppBar , but the issue still occurs for us . We 're on the latest version of MyToolkit ( 2.5.16 as of this writing ) . Our views are derived like so : SomeView derives from Ba... | Why does my AppBar appear as ClosedDisplayMode.Compact on Page load regardless of actual setting ? |
C_sharp : What does the @ sign does when inserted in front of parameters SQL query ? for example : <code> using ( SqlCommand cmd = new SqlCommand ( `` INSERT INTO [ User ] values ( @ Forename , @ Surname , @ Username , @ Password ) '' , con ) ) { cmd.Parameters.AddWithValue ( `` @ Forename '' , txtForename.Text ) ; cmd... | What does the @ in front of a parameter name do ? |
C_sharp : I know a lot has been written about Linq and it 's inner workings . Inspired by Jon Skeets EduLinq , I wanted to to demystify what 's going on behind the Linq Operators . So what I tried to do is to implement Linqs Select ( ) method which sounds pretty boring at first sight . But what I 'm actually trying to ... | Implementing Linqs Select without the yield keyword . Ca n't follow the control flow |
C_sharp : I have an total amount payable by an Employer this amount needs to be split amongst staff.For exampleThe total amount payable is the sum of all items , in this case $ 400The problem is I must call a 3rd party system to assign these amounts one by one . But I can not let the balance go below $ 0 or above the t... | Allocate money in particular order |
C_sharp : I just stumbled upon this fragment of code , I was wondering why the Count is done during the loop.If the count can change , shouldn ’ t we just do it like this instead : for ( int i = source.Count ( ) - 1 ; i > = 0 ; i -- ) Otherwise , I think we should calculate the count before the looping starts , instead... | IEnumerable.Count ( ) O ( n ) |
C_sharp : Consider this code : Inside the function , I want to know if a value has been sent to Variable1 & Variable2 , prior to the function call , even if the DEFAULT values have been sent , that 's ok ( null for string & 0 for int ) <code> public string Variable1 { get ; set ; } public int Variable2 { get ; set ; } ... | Ensure Variable Initialization C # |
C_sharp : When I am using this code as web view , it works fine , but when with developer option in Chrome I select Mobile View , FormCollection shows empty strings in the controllerVIEW ( Edit updtaed ) ControllerNormal View ( Web View ) Mobile View <code> < div class= '' page product-details-page deal-product-details... | FormCollection Empty in ASP.NET Mobile View |
C_sharp : I 'm trying to write generic algorithms in C # that can work with geometric entities of different dimension . In the following contrived example I have Point2 and Point3 , both implementing a simple IPoint interface.Now I have a function GenericAlgorithm that calls a function GetDim . There are multiple defin... | C # generics method selection |
C_sharp : I have a list of sorts stored in this format : And I need to turn it into a lambda expression of type Action < DataSourceSortDescriptorFactory < TModel > > So assuming I have the following collection of Report Sorts as : I would need to transform it into such a statement to be used like so : And the sort meth... | Dynamically build lambda expression from a collection of objects ? |
C_sharp : I have two similar methods that basically does the same thing only with different objects.What 's the best way to make a generic method out of this if possible ? The two objects : The two methods that I potentially want to make into a generic : I must note that : - I have no control over how the table fields ... | How to create a generic method out of two similar yet different methods ? |
C_sharp : According to the Best Practices section of the MSDN documentation for the System.Enum class : Do not define an enumeration value solely to mirror the state of the enumeration itself . For example , do not define an enumerated constant that merely marks the end of the enumeration . If you need to determine the... | Why are position markers , like first or last , in an Enumeration considered bad practice ? |
C_sharp : I am new to .Net Framework and I want to add validations to my windows form application in Visual Studio 2010 IDE . I have searched for different ways to do it but I am not sure where can i add that code in my form ? One of the example being the code below . Do I add this code on form load method or on submit... | Validating my form |
C_sharp : This question has been bugging me for a while : I 've read in MSDN 's DirectX article the following : The destructor ( of the application ) should release any ( Direct2D ) interfaces stored ... Now , if all of the application 's data is getting released/deallocated at the termination ( source ) why would I go... | Cleanup before termination ? |
C_sharp : I thought the method that is getting called is decided runtime , or have I missed something ? Sample code : I thought I would get : as output but it prints Base impl . Is there anything I can do to get the overloaded method without casting the input ? <code> class Program { static void Main ( string [ ] args ... | Why is n't the overloaded method getting called ? |
C_sharp : Starting from C # 7.0 the throw keyword can be used both as an expression and as a statement , which is nice.Though , consider these overloadsWhen invoking like thisor even like this ( with a statement lambda ) the M ( Func < > ) overload is selected by the compiler indicating that the throw is here considere... | How can I force a throw to be a statement and not an expression ( in a lambda expression ) ? |
C_sharp : I come across this regularly when refactoring code . Say I have a base class and I read some configuration parameters and stuff them into properties like this And then I call a method in another class like thisIs it better to do that ? What if I only needed the AppSettings values inside of the OtherClass clas... | Passing config values as parameters to an instance method C # |
C_sharp : In all the .NET book I 've read the guide line for implementing events explains that you need to subclass EventArgs and use EventHandler . I looked up more info on http : //msdn.microsoft.com/en-us/library/ms229011.aspx , and it says `` Do use System.EventHandler instead of manually creating new delegates to ... | Is there a special association between the EventArgs class and the event keyword ? |
C_sharp : I have a problem with this code : I set TermEndDate = DateTime.Now but no message raises ! My test code is : <code> RuleFor ( field = > field.TermEndDate ) .NotEmpty ( ) .When ( x = > x.TermEndDate == x.TermStartDate ) .WithMessage ( `` error ... '' ) ; var now = DateTime.Now ; var command = new AddTermComman... | FluentValidation when does not raises any message |
C_sharp : If I create a .NET class which subscribes to an event with an anonymous function like this : Will this event handler be a root keeping my class from being garbage collected ? If not , wohoo ! But if so , can you show me the removal syntax ? Just using -= with the same code seems wrong . <code> void MyMethod (... | Do I need to remove this sort of event handler ? |
C_sharp : I have:1 ) How I may get List < Graph > from database where Points is not empty ? 2 ) How to execute it ? The exception is : LINQ to Entities does not recognize the method ' ... ' method , and this method can not be translated into a store expression . <code> private Dictionary < int , Сolor [ ] > colorSet = ... | C # Linq - get objects with not empty collection |
C_sharp : Consider the following code : Now when I call both generic functions , one succeeds and one fails : Apparently , G.enericFunction2 executes the default operator== implementation instead of my override . Can anybody explain why this happens ? <code> class CustomClass { public CustomClass ( string value ) { m_v... | Using overloaded operator== in a generic function |
C_sharp : I happened to read this line of code : Where can I find the document on msdn about the syntax of using `` this '' in property ? And is there any book covers this kind of tricky syntax of C # other than the common stuff ? <code> public MyArray this [ int index ] { get { return array [ index ] ; } } | What is this syntax : using `` this '' in property in C # ? |
C_sharp : I 'm working on a progress wizard . I defined it as a style based on the ItemsControl . I have an ItemTemplateSelector with two DataTemplates , one for the first item and one for the rest of the items . I have it working correctly except for one really small issue that is super tricky to fix . There is a gap ... | Uniform Grid as Panel Template for All Items in ItemsControl Except the First |
C_sharp : In C # , is it possible to write something like this : I know that the above implementation does not compile , but what I am actually trying to achive is implementing some kind of generic wrapper to an unknown type , so that an client can call the wrapper just as he would call the type , provided by the param... | Is it possible to make an object expose the interface of an type parameter ? |
C_sharp : There 's probably 5 or 6 SO posts that tangentially touch on this , but none really answer the question.I have a Dictionary object I use kind of as a cache to store values . The problem is I do n't know how big it is getting -- over time it might be growing big or not , but I can not tell and so I ca n't gaug... | Logging the memory usage of an object |
C_sharp : Why do explicit C # interface calls within a generic method that has an interface type constraint always call the base implementation ? For example , consider the following code : This code outputs the following : IDerived.Method IBase.MethodInstead of what one might expect : IDerived.Method IDerived.MethodTh... | Why do explicit interface calls on generics always call the base implementation ? |
C_sharp : I 've two interfaces : And two classes implementing these interfaces like this : When trying to use these classes as shown : I get this compiler error : can not convert from 'ClassB ' to 'IAmB < IAmA > ' I know I can make the compiler happy using : But I need to be able to be the Type parameter for IAmB < > i... | C # Generics , interfaces and inheritance |
C_sharp : I have the following code in my classThis code works in that when I dispose my class any events that are hooked up to the Received event , will be removed individually.I 've been wondering if rather than being so verbose about it , if the following terse version will have the same effectBasically this comes d... | Can you use equals assignment when removing delegate members in a disposing method ? |
C_sharp : I was going through the Martin Odersky 's book Programming in Scala with it 's section on abstract modules , and his paper Scalable Component Abstractions : http : //lampwww.epfl.ch/~odersky/papers/ScalableComponent.pdfMy takeaway is that by making your modules abstract classes instead of objects ( or classic... | Scala-style abstract modules in C # or other languages ? |
C_sharp : When I insert these values in SqlServer database , the millisecond value changes in a weird wayWhat 's wrong ? Edit : Relevant code : <code> 09/30/2013 05:04:56.599 09/30/2013 05:04:56.59909/30/2013 05:04:56.59909/30/2013 05:04:57.082 2013-09-30 05:04:56.600 2013-09-30 05:04:56.600 2013-09-30 05:04:56.600 201... | DateTime inserted in SqlServer changes value |
C_sharp : I have a struct that is defined in a COM library.In my ViewModel I have created an observable instance of this , and want to bind each member of the struct to different controls in a view.ConfigStaticDataDetails variable is updated through a delegate in the COM.Is there a way to catch updates to the members o... | Can I catch updates to members of an observable struct in WPF ? |
C_sharp : I get very strange behaviour of string.Format . I form message like this : The letters in beginning are in Russian . But then , in calling method , i get this string : Äèñïåò÷åð çàêðûë ñîáûòèå Тревога ( `` Тревога на объекте с точки зрения диспетчера '' ) . This seems like string.Format returned non-unicode c... | C # String.Format ( ) returns bad characters |
C_sharp : I 'm interested in this part : What 's wrong : One of the parameters of a binary operator must be the containing typeHow I can normaly code this part for mathematic operations ? <code> public class Racional < T > { private T nominator ; private T denominator ; public T Nominator { get { return nominator ; } s... | Help with mathematic operands in class ( c # ) |
C_sharp : I 'm doing a Unity project where I have the need to convert UTM coordinates to latitudes and longitudes . I have tried several C # solutions , but none of them were accurate enough . But I found some Javascript code that gives out the exact result I 'm looking for ( https : //www.movable-type.co.uk/scripts/la... | C # and Javascript code calculations giving different results |
C_sharp : We use ASP.NET core and have this code : After zipping sourceDirectoryName that contains russian symbols if we open this archive with windows explorer , we see the following : and where the name marked with green is correct , and the name marked with red has its name encoding changed.If we use the following c... | After zipping folder all zip entries change encoding |
C_sharp : When I use a method with a generic parameter to create another object , the generic object is n't selecting the most specific constructor . That sounds confusing , so here 's some sample code to demonstrate what I mean ... Can anyone explain why the output of this program is : ... and how to make the generic ... | Generic method is n't choosing the most specific constructor signature ? |
C_sharp : One of the requirements of the system that I am helping to develop is the ability to import files and we have a set of adapters to process the different types of file ( csv , xml etc . ) we would expect to encounter . During the early part of development we were hard-coding the data adapters via reference and... | Loading more dll 's into code causes crash |
C_sharp : I have a windows media player embedded in my web page view : The ShowMovie action extracts a video stream from the database and sends it to the view with this : When I use a video with a size of about 10K or so will play fine . But if I use a file that is about 137K or so the file never plays . Is it too larg... | WMV streaming file size limit |
C_sharp : I 'd like to know your opinion on a matter of coding style that I 'm on the fence about . I realize there probably is n't a definitive answer , but I 'd like to see if there is a strong preference in one direction or the other.I 'm going through a solution adding using statements in quite a few places . Often... | A question of style/readability regarding the C # `` using '' statement |
C_sharp : In another question , people are getting incomplete data when reading from a HttpWebResponse via GetResponseStream ( ) .I too encountered this problem when reading data from an embedded device which should send me the configuration of 1000 inputs , all in all 32 bytes header and 64 bytes * 1000 resulting in 6... | Why is HttpWebResponse losing data ? |
C_sharp : I am looking into the grammar of C # 5.0 and do n't quite understand the use of `` base '' . In the reference manual , there is a notion of `` base access '' defined as : Where base is a keyword , and it appears that this is the only case . However , I encounter C # inputs such as Can someone point me out whi... | C # grammar `` base '' |
C_sharp : I currently have a class and I am a bit confused with its constructor . what does the statement this ( new BarInterval [ ] { interval } ) imply ? <code> public class BarListTracker : GotTickIndicator { public BarListTracker ( BarInterval interval ) : this ( new BarInterval [ ] { interval } ) { } } | ` this ` and a class constructor |
C_sharp : I 've read so many articles about this but still I have 2 questions.Question # 1 - Regarding Dependency Inversion : It states that high-level classes should not depend on low-level classes . Both should depend on abstractions . Abstractions should not depend on details . Details should depend on abstractions.... | S.O.L.I.D Essentials missing points ? |
C_sharp : I have an enumeration with flags . I want to declare a variable with n different flags . n > 1 in this case.Okay - one variant is to cast each flag into an byte and cast the result to my enum . But this is kinda messy - imho . Is there an more readable way to combine flags ? <code> public enum BiomeType { War... | How to combine enumerations with flags ? |
C_sharp : EDIT : I 've done some research about this , but have not been able to find a solution ! I 'm reading a configuration from an XML file.The layout of the configuration is set for certain version.This version is in the first line of the XML , which is easy to extract.What I would like to know is , what is the b... | Parse file differently upon different version |
C_sharp : I 'm a Java programmer . I have little knowledge on C # . But from the blogs I have read , Java supports only pass-by-value-of-reference whereas in C # the default is pass-by-value-of-reference but the programmer can use pass by reference if needed . I have penned down my understanding of how a swap function ... | how does a swap method work in C # at a memory level ? |
C_sharp : I 've written a little parsing program to compare the older System.IO.Stream and the newer System.IO.Pipelines in .NET Core . I 'm expecting the pipelines code to be of equivalent speed or faster . However , it 's about 40 % slower.The program is simple : it searches for a keyword in a 100Mb text file , and r... | Why is this System.IO.Pipelines code much slower than Stream-based code ? |
C_sharp : I have a user controller created using the hartl tutorial that signs up new users via form with email and password inputs . This is working properly . I am attempting to send an HttpWebRequest from the Unity editor player to my server in order to sign up a new user from a password string created within Unity ... | How to use Ruby on Rails users controller via Unity ( C # ) to sign up a new user ? |
C_sharp : I need a function which can calculate the mathematical combination of ( n , k ) for a card game . My current attempt is to use a function based on usual Factorial method : It 's working very well but the matter is when I use some range of number ( n value max is 52 and k value max is 4 ) , it keeps me returni... | Combinatory issue due to Factorial overflow |
C_sharp : i want to create a windows form which takes image from file and displays in the pictureBox in c # i am having problem when i type image.FromFile after `` = '' the FromFile gets red underline as if it does not consists in the library . <code> 1 using System ; 2 using System.Collections.Generic ; 3 using System... | .FromFile underlined red and showing error |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.