text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : Overloading the comparison operator , how to compare if the two variables points to the same object ( i.e . not value ) <code> public static bool operator == ( Landscape a , Landscape b ) { return a.Width == b.Width & & a.Height == b.Height ; } public static bool operator ! = ( Landscape a , Landscape b ) { r... | After overloading the operator== , how to compare if two variables points at the same object ? |
C_sharp : Pretty basic question , but I ca n't seem to find the answer anywhere.How do you specify a new instance of a Dictionary < string , string > in SOAP ? Basically I have this envelope ( ommitted envelope top level tag for readability ) : RequestInfo is the property in question , but it 's always null . I assumed... | Creating a new Dictionary in a SOAP Envelope |
C_sharp : Why is it necessary to use the new keyword when a method shall be hidden ? I have two classes : Following code produces the given output : Output : ParentOutput : ChildI understand that this might be a problem if it the hiding was not intended but is there any other reason to use `` new '' ( excepted avoding ... | Why using `` new '' when hiding methods ? |
C_sharp : With this code : ... I 'm stopped dead in my tracks with So how do I accomplish this ? <code> private bool AtLeastOnePlatypusChecked ( ) { return ( ( ckbx1.IsChecked ) || ( ckbx2.IsChecked ) || ( ckbx3.IsChecked ) || ( ckbx4.IsChecked ) ) ; } Operator '|| ' can not be applied to operands of type 'bool ? ' and... | How can I return a bool value from a plethora of nullable bools ? |
C_sharp : I am working on trying to close a specific MessageBox if it shows up based on the caption and text . I have it working when the MessageBox does n't have an icon.The above code works just fine when the MessageBox is shown without an icon like the following.However , if it includes an icon ( from MessageBoxIcon... | How to get the text of a MessageBox when it has an icon ? |
C_sharp : On the form called `` Dev '' I have the following OnFormClosing function to make sure a thread is closed properly when a user closes the form.Works fine if I close the `` Dev '' form directly . But if the `` Dev '' form closes because the main form ( `` Form1 '' ) was closed ( which causes the program to exit... | Forms not closing properly if terminated due to program exit / main form close |
C_sharp : I have an action method like this below.I have a model with the following classes , which I 'd like to load the data from the ajax JSON data . Here is the JSON data . DefaultModelBinder is handling the nested object structure but it ca n't resolve the different sub classes . What would be the best way to load... | DefaultModelBinder and collection of inherited objects |
C_sharp : I 'm trying to implement something like the idea I 'm trying to show with the following diagram ( end of the question ) .Everything is coded from the abstract class Base till the DoSomething classes.My `` Service '' needs to provide to the consumer `` actions '' of the type `` DoSomethings '' that the service... | C # how to `` register '' class `` plug-ins '' into a service class ? |
C_sharp : I 'm writing custom security attribute and got strange compiler behaviour ... When I 'm using the attribute at the same file , default parameter values works fine : But when I 'm separating the code above into two files like that - file 1 : And file 2 : I 've got an compiler error : Error : 'FooAttribute ' do... | Is this an C # 4.0 compiler optional parameters bug ? |
C_sharp : Why is n't it possible to cast an instance of : ... to this interface : ... even though Foo has the signature of IBar ? How can I turn an instance of Foo into an IBar ? Assume I have no control over Foo . <code> sealed class Foo { public void Go ( ) { } } interface IBar { void Go ( ) ; } | Possible to cast to interface that is n't inherited ? |
C_sharp : i have a stupid question , but i want to hear the community here.So here is my code : My question , is it any different than : Which one is better in general ? which one in terms of GC and why ? <code> using ( FtpWebResponse response = ( FtpWebResponse ) request.GetResponse ( ) ) { return true ; } ( FtpWebRes... | Do I need to dispose of a resource which is not actually used ? |
C_sharp : Consider the following piece of code : As you can see we are on line 28 . Is there any way to see the return value of the function at this point , without letting the code return to the caller function ? Foo.Bar ( ) is a function call which generates a unique path ( for example ) . So it 's NOT constant.Enter... | See return value in C # |
C_sharp : I happened upon this in an NHibernate class definition : So this class inherits from a base class that is parameterized by ... the derived class ? My head just exploded . Can someone explain what this means and how this pattern is useful ? ( This is NOT an NHibernate-specific question , by the way . ) <code> ... | C # unusual inheritance syntax w/ generics |
C_sharp : Say I have the following : Two Questions:1.I 'm a little confused on when my IDisposable members would actually get called . Would they get called when an instance of CdsUpperAlarmLimit goes out of scope ? 2.How would I handle disposing of objects created in the CdsUpperAlarmLimit class ? Should this also der... | IDisposable Question |
C_sharp : Consider this code : Results : Why are the results different between List < T > and Array ? I guess this is by design , but why ? Looking at the code of List < T > .IndexOf makes me wonder even more , since it 's porting to Array.IndexOf . <code> public static void Main ( ) { var item = new Item { Id = 1 } ; ... | Why is Array.IndexOf not checking for IEquatable like List < T > does ? |
C_sharp : I wanted to create an observableCollection that is sortableso i started creating a class that inherit observable with some methods to sort it , then i wanted that class to persist the index into the childs , so i created an interface that expose an index property where i can write to , and i costrainted the T... | Covariance in generic interfaces |
C_sharp : I 'm trying to use a Microsoft.Toolkit.Wpf.UI.Controls.WebView control in a wpf desktop application . It seems to use substantially less resouces than the webbrowser control and is much more up to date , being based on edge . However , unlike the webbrowser control , it wo n't scroll unless selected . i.e . W... | how to make wpf webview scroll like webbrowser ? |
C_sharp : Why is it not possible to use implicit conversion when calling an extension method ? Here is the sample code : Error i get : 'int ' does not contain a definition for 'ToNumberString ' and the best extension method overload 'Ext.ToNumberString ( decimal ) ' requires a receiver of type 'decimal'As we can see . ... | Implicit conversion when calling an extension method not possible |
C_sharp : Often I have a bit of code I want to execute from time to time , for example seed the database , drop the database , download some data from the database and collate it in some funny way . All of these tasks can be represented as independent functions in C # . Ala a console app : Here , I comment out the func... | Is there any extension to visual studio that allows to run functions as tasks ? |
C_sharp : I have a partial view that is using a different model than the view that I 'm rendering it in . I keep getting the error message . The model item passed into the dictionary is of type 'JHelpWebTest2.Models.CombinedModels ' , but this dictionary requires a model item of type 'JHelpWebTest2.Models.PagedStudentM... | Different Model in Partial View |
C_sharp : I fixed all the problems described here ( and one additional ) , and posted the modifiedcsharp-mode.el ( v0.7.1 ) at emacswikiThe csharp-mode I use is almost really good . It works for most things , but has a few problems : # if / # endif tags break indentation , but only within the scope of a method.attribut... | How can I fix csharp-mode.el ? |
C_sharp : I need to recover JSON stored in RavenDb database knowing its Id . What 's tricky here , I need to get it before it is deserialized into an actual object . Reason for that is , I need it in exact same form it was first stored in , regardless what happens to the CLR class ( it can drastically change or even be... | RavenDb get raw JSON without deserialization |
C_sharp : I have around 6 WCF services that I want to host in an MVC application , routing requests to /services/foo to WcfFooService and /services/bar to WcfBarServiceI can accomplish IoC with StructureMap within the services and inject my constructor dependencies by using the example that Jimmy Bogard blogged about h... | How can I host multiple IoC-driven WCF services in MVC ? |
C_sharp : I have a bunch of systems , lets call them A , B , C , D , E , F , G , H , I , J.They all have similar methods and properties . Some contain the exact same method and properties , some may vary slightly and some may vary a lot . Right now , I have a lot of duplicated code for each system . For example , I hav... | Interface , Abstract , or just virtual methods ? |
C_sharp : I have a datagrid which is bound to a datatable . I would like to know - How can we show the Cursor as blinking in the first cell of an empty row of this datagrid which is bound to the datatable . Also , when a user adds a new empty row to this datatable/datagrid by hitting the enter key , The cursor should b... | How to set the cursor on the first cell of an empty row in datagrid which is bound to a data table |
C_sharp : I 'm still a beginner to programming in high-level programming languages , so I do n't know if this is an easy solution , but I 'm happy to learn anyway . I 've programmed a little alarm program in C # that let 's the user input in how many seconds the alarm needs to go off . It works perfectly , but the inpu... | How to prevent certain forms of input when writing methods ? |
C_sharp : I got this idea while thinking of ways to recycling objects . I am doing this as an experiment to see how memory pooling works and I realize that in 99 % of scenario this is very unnecessary . However , I have a question . Is there a way to force the GC to keep the object ? In other words , can I tell the GC ... | Keep object on GC destruction attempt |
C_sharp : After two questions and much confusion - I wonder if I finally got it right . This is my understanding : async/await serves only one purpose - to allow code to be executed after an already asynchronous task is finished.e.g.allows AnotherMethod to be executed after the asynchronous AsyncMethod is finished inst... | async/await - Is this understanding correct ? |
C_sharp : Does taking address of a C # struct cause default constructor call ? For example , I got such structs : Then , of course , I ca n't do this : But once I obtain pointer to the struct , I can read its fields even without using the pointer , and even embedded struct 's fields : So , does it call the default cons... | Struct pointer ( address ) , and default constructor |
C_sharp : My code is ... Resharper is recommending ... <code> public static void AssertNotNull < T > ( string name , T val ) { if ( val == null ) throw new ArgumentNullException ( String.Format ( `` { 0 } must not be null '' , name ) ) ; } public static void AssertNotNull < T > ( string name , T val ) { if ( Equals ( v... | Why is resharper making the following recommendation ? |
C_sharp : I am a newbie to Cassandra and created a generic repository for my Cassandra database using linq . For my Single ( ) method , I am passing the where criteria as a parameter . This is my Single method : This is the linq code I am using to query the cassandra databaseThis is the method calling the single method... | Cassandra : Argument types do not match |
C_sharp : Why does PHP return INF ( infinity ) for the following piece of code : The expected result was 4321 , but PHP returned INF , float type : I wrote the same code in Python and C # and got the expected output - 4321PythonC # <code> < ? php $ n = 1234 ; $ m = 0 ; while ( $ n > 0 ) { $ m = ( $ m * 10 ) + ( $ n % 1... | Unexpected behavior in PHP - Same code gives correct results in C # and Python |
C_sharp : Possible Duplicate : .NET Enumeration allows comma in the last field Since both compile , is there any differences between these declarations ? <code> public enum SubPackageBackupModes { Required , NotRequired //no comma } public enum SubPackageBackupModes { Required , NotRequired , //extra unnecessary comma ... | Unnecessary comma in enum declaration |
C_sharp : I read a book `` CLR via C # Fourth Edition '' . And I can not understand one statement : So , for example , if you have the following line of code : then when the CLR creates the FileStream [ ] type , it will cause this type to automatically implement the IEnumerable < FileStream > , ICollection < FileStream... | Auto implemented interfaces in Arrays |
C_sharp : For convenience and safety reasons i 'd like to use the using statement for allocation and release of objects from/to a pool and the access the pool likeI found some topics on abusing using and Dispose ( ) for scope handling but all of them incorporate using ( Blah b = _NEW_ Blah ( ) ) .Here the objects are n... | Abuse using and Dispose ( ) for scope handling of not to be released objects ? |
C_sharp : I am launching these two console applications on Windows OS.Here is my C # codeAnd here is my C code . I am assuming it is C because I included cstdio and used standard fopen and fprintf functions.When I start C # program I immediately see the message `` Done ! '' . When I start C++ program ( which uses stand... | Why my C # code is faster than my C code ? |
C_sharp : I can easily start a process with it 's STD I/O redirected but how can I redirect the STD I/O of an existing process.Exception : StandardOut has not been redirected or the process has n't started yet.Side note : If you know how to do this in C/C++ I 'd be happy to re-tag and accept . I just need to know if it... | How to redirect the STD-Out of an **existing** process in C # |
C_sharp : I have a C # function with following signature : I call it from C++ . I was informed by compiler that 2-nd param must have SAFEARRAY* type . So I call it in this way : But safeArray is not updated , it still contains zores . But I tested Get1251Bytes function in C # unit-test . It works properly and updates r... | C # function does n't update SAFEARRAY |
C_sharp : I started out programming with C # a few days ago.Now an confusing error arised when playing around with operator overloading.The following code produces a StackOverflowException when running : I tried to write an own example after reading the chapter about operater overloading from the book `` Microsoft Visu... | Operator Overloading causes a stack overflow |
C_sharp : I 'm developing a simple lambda function with .net core . For this , I 'm using the AWS tookit . My project have a three resources file , one with default message , and two with italian and french greetings.For this , my function receive a query string parameter , and depending on this value , I set the cultu... | AWS Lambda is not recognizing the culture on .net core |
C_sharp : At work I just installed a brand new copy of my OS and a brand new copy of VS2015 . When I clone my solution for the first time , I can not build it anymore , even if I 've generated the C # files like I always do , by opening the .edmx file first , and clicking on `` save '' icon.When building it throws the ... | EntityFramework not generating C # files properly ( some enums are incomplete , so build fails ) |
C_sharp : I found this code snippet on a blog as a `` Convert Binary data to text '' And this provides a output of AAAAAQAB .. What is not clear is that how 000101 - > is mapped to AAAAAQAB , and will I able to use this to all a-z characters as a binary equivalent and how ? or is there a any other method ? <code> Byte ... | C # byte array problem |
C_sharp : I have a query that looks something like this : MultiframeModule and Frame have an many-to-many relation.With that query I want to find a MultiframeModule that contains all frames inside the frames collection I sent as a parameter , for that I check the ShaHash parameter.If frames contains 2 frames , then the... | Query with large WHERE clause causes timeout exception in EF6 with npgsql |
C_sharp : So heres my question . I have a Asp.net application with a form based authentication . I have users in my database but the users also has to be in the active directory.The following code is for me to check if user is in the domain AThis code work fine . The problem is client is requesting that domain B should... | How to query Active Directory B if application server is in Active Directory A |
C_sharp : Given the following test : I want to encapsulate fixture creation in its own class , something akin to : The problem is that I 'm using PropertyData and the latter is supplying two input parameters . The fact that I 'm then trying to automatically create my fixture as a parameter is causing an exception . Her... | AutoFixture : PropertyData and heterogeneous parameters |
C_sharp : Is it possible to publish an build artifact to Azure Devops/TFS through build.cake script ? Where should the responsibility for publishing the build artifact be configured when converting to cake scripts , in the build.cake script or in the Azure DevOps pipeline ? To achieve versioning in our build and releas... | Publish build artifact through build.cake instead of Azure Devops |
C_sharp : BriefI 've created a beautiful WindowChrome style to apply to my windows . When I add ContentControl to my style , however , the application enters break mode.I 've pieced together code from this youtube video , this article , this SO question and Microsoft 's documentation and I 've come up with the followin... | Why does adding ContentControl cause my application to enter break mode ? |
C_sharp : What I understand unboxing is when I take a object and unbox it to valuetype like the MSDN example : So I just was thinking , can a string be unboxed ? I think , No it ca n't because there is no valuetype that can represent a string . Am I right ? <code> int i = 123 ; object o = i ; o = 123 ; i = ( int ) o ; ... | Can I unbox a string ? |
C_sharp : I have a array of data : I 'd like it to be sorted from Alphanumeric to Non-Alphanumeric.Example : A B E N ! $ How would I go about accomplishing this ? <code> ! ABE $ N | Sorting from Alphanumeric to nonAlphnumeric |
C_sharp : Trying to get a custom CoreLib in .NET Core project to load in VS 2017 . This was super easy in .NET Framework as all you needed was `` NoStdLib '' but with .NET Core seems like a lot more parts are needed.I keep getting : `` Project file is incomplete . Expected imports are missing . `` Going off what System... | Custom `` CoreLib '' In .NET Core ? |
C_sharp : My Regex is removing all numeric ( 0-9 ) in my string.I do n't get why all numbers are replaced by _ EDIT : I understand that my `` _ '' regex pattern changes the characters into underscores . But not why numbers ! Can anyone help me out ? I only need to remove like all special characters.See regex here : <co... | regex issue c # numbers are underscores now |
C_sharp : I 'm seeing an inconstancy with how the CRM SDK treats searching for entities by an OptionSetValue attribute , and creating an entity with an OptionSetValue Attribute.Back Ground : I have a method with this signaturewhere the columnNameAndValuePairs is a list of pairs that look like this : ( string name of th... | Why must I use an int when searching for an entity with an OptionSetValue attribute , but use an OptionSetValue object when creating an entity ? |
C_sharp : I have the following table in SQL Server : ProductAttributeName : nvarchar ( 100 ) Value : nvarchar ( 200 ) This is mapped via Entity Framework into my class : Some rows of ProductAttributes have the following form : { Name : `` RAM '' , Value : `` 8 GB '' } , { Name : `` Cache '' , Value : `` 3000KB '' } I n... | Build Expression Tree convertible to valid SQL dynamically that can compare string with doubles |
C_sharp : I 've just `` earned '' the privilege to maintain a legacy library coded in C # at my current work.This dll : Exposes methods for a big legacy system made with Uniface , that has no choice but calling COM objects.Serves as a link between this legacy system , and another system 's API.Uses WinForm for its UI i... | Make my COM assembly call asynchronous |
C_sharp : After instantiating a list ( so ignoring the overhead associated with creating a list ) , what is the memory cost of adding the same object to a list over and over ? I believe that the following is just adding the same pointer to memory to the list over and over , and therefore this list is actually not takin... | List with repeat objects - What is the memory cost ? |
C_sharp : Possible Duplicate : Should I Create a New Delegate Instance ? Hi , I 've tried searching for the answer to this , but do n't really know what terms to search for , and none of the site-suggested questions are relevant . I 'm sure this must have been answered before though.Basically , can somebody tell me wha... | C # : what 's the difference between SomeEvent += Method and SomeEvent += new Delegate ( Method ) |
C_sharp : I have a data table with the following details.I want to merge values of Column ENTITY as below.is there any way we can achieve it using Linq ? <code> ID | VERSION | ENTITY1 | 01 | A011 | 01 | A022 | 01 | A012 | 01 | A02 ID | VERSION | ENTITY1 | 01 | A01/A022 | 01 | A01/A02 | C # : Merge Datarows in the datatable |
C_sharp : In my MVC controller , i have an action that will populate a stream which i will use later : I had this problem because ReSharper is giving out a warning : access on disposed closure on the line PopulateFile ( fileParams , stream ) and pointing out stream.I have searched for the meaning of it and it seems tha... | await population of a stream |
C_sharp : I have a simple wrapper for a Unity IoC container ( a temporary use of Service Locator [ anti- ] Pattern to introduce DI to a legacy codebase ) , and since the IUnityContainer in Unity implements IDisposable I wanted to expose that through the wrapper as well.The wrapper is simple enough : IIoCContainer is th... | Stack Overflow when Disposing a Managed Resource |
C_sharp : I 've made a class ( code below ) that handles the creation of a `` matching '' quiz item on a test , this is the output : It works fine.However , in order to get it completely random , I have to put the thread to sleep for at least 300 counts between the random shuffling of the two columns , anything lower t... | How can I get true randomness in this class without Thread.Sleep ( 300 ) ? |
C_sharp : I suppose this is more of a public rant , but why ca n't I get c # to infer my Id 's type ? and a defined EntityObject with a Guid as an Id as follows : Inheriting from the abstract EntityObject class defined as follows : Usage of the get method would be as follows : edited to provide further clarification . ... | Inference from Generic Type Question |
C_sharp : What I am looking for is a way to call a method after another method has been invoked but before it is entered . Example : In the example above I would like to have Tracer ( ) called after SomeFunction ( ) has been invoked by TestFun ( ) but before SomeFunction ( ) is entered . I 'd also like to get reflectio... | Is there a way in .NET to have a method called automatically after another method has been invoked but before it is entered |
C_sharp : Not return value optimization in the traditional sense , but I was wondering when you have a situation like this : This could obviously be written more optimally : I just wondered whether anyone knew if the ( MS ) compiler was clever enough not to generate state machines for Method1 ( ) and Method2 ( ) in the... | Does compiler perform `` return value optimization '' on chains of async methods |
C_sharp : This question stems from a bug where I iterated over a collection of Int64 and accidentally did foreach ( int i in myCollection ) . I was trying to debug the baffling problem of how when I did a linq query , i was not part of the myCollection.Here 's some code that surprised me : I expected the compiler to gi... | Why does C # let me overflow without any error or warning when casting an Int64 to an Int32 and how does it do the cast ? |
C_sharp : I am trying to get the data from database by using the below code ... ..if there is no data in the table it will always goes to this statementI am using mysql.net connector for getting the data and i am doing winforms applicationsusing c # and the below code is for return sqlexceution ... function..even if th... | problem with getting data from database |
C_sharp : I 'm having some trouble finding answers to a question I have about some code specific to what i 'm working on and I can not seem to find some documentation on how Union works at it 's core mechanics in C # . So the problem is this.I have a set of data that works similar to this example : Is it more efficient... | C # Union vs Contains for lists of continuous data |
C_sharp : I am unable to view the debug information when using a Task of Tuple . E.G . When a breakpoint his hit , I can not view any variables on hover , in the local window , or in the watch window.The repro is just to create a new WPF app , add System.ValueTuple , add this code to MainWindow.xaml.cs , and then set b... | VS2017 Error debugging Task of Tuple |
C_sharp : I 'm trying to set up a TLS connection to an application running in a ( local ) VM using C # 's HttpClient on Windows . However , it results in a RemoteCertificateNameMismatch error every time . This piece of code : Results in this error : However , my certificate is valid according to Google Chrome and Mozil... | How to start a trusted TLS connection with a server by IP address using HttpClient in C # ? |
C_sharp : Using the Entity-Component-System pattern I want to connect some systems with events . So some systems should n't run in a loop , they should just run on demand.Given the example of a Health system a Death system should only run when a component gets below 1 health.I thought about having two types of systems ... | connect systems with events |
C_sharp : I 'm looking at customising the various pieces of text in an application for different customers . It seems like .resx resources would be a sensible way to do this . However , all the literature for resx I come across seems to be about localising for language differences ( as in English , French , Spanish , e... | Are resx files a suitable way to customise for different customers ? |
C_sharp : In my services all exposed methods have : It 's boring and ugly to repeat it over and over again . Is there any way to avoid that ? Is there a better way to keep the service working even if exceptions occur and keep sending the exception details to the Log class ? <code> try { // the method core is written he... | How to refactor logging in C # ? |
C_sharp : I have an industrial computer with some Digital I/O pins . The manufacturer provides some C++ libraries and examples to handle pin status change.I need to integrate this events onto a C # application . AFAIK the most simple way to perform this is : Make a managed C++/CLI wrapper for the manufacturer libraries... | Firing events in C++ and handling them in C # |
C_sharp : I have such constructionCan I get all unique value from propIDs with LINQ.For example I have list of ( 1,2 ) ( 4,5 ) ( 1,5 ) ( 1,2 ) ( 1,5 ) and I must get ( 1,2 ) ( 4,5 ) ( 1,5 ) <code> List < int [ ] > propIDs = new List < int [ ] > ( ) ; | How can I retrieve a set of unique arrays from a list of arrays using LINQ ? |
C_sharp : What is the correct way for a application to restart another copy of itself with the same arguments ? My current method is to do the followingHowever it seems like there is a lot of busy work in there . Ignoring the striping of the vshost , I still need to wrap arguments that have spaces with `` and combine t... | Start a second copy of the program with the same arguments |
C_sharp : I 'm developing an app and I 'd like when the user is in Tablet Mode and switches from one app to other to show a black screen when you press `` alt + tab '' and the opened apps are being shown . I 'd like instead of showing the `` myTrip '' screenshot of the app to show a black screen.I know for WPF we had S... | Hide app preview from Alt-tab taskbar in Windows 10 Universal App Platform |
C_sharp : I want to learn how can I add to my controller some SQL query but I do n't know how to do it properly.My controller isBy default page is giving me the next data . I want to add the next SQL query to the controller which will give me data that I want it on page to display . <code> public ActionResult Index ( )... | ASP.net.MVC 5 create a page which will display sql query |
C_sharp : I have a situation where I 'd like the behaviour of the compiler explained . Given a little code : The following compiles and runs : If we make a change to the signature of the Foo class and add the sealed keyword : Then I get a compiler error on the following line : Of : Can not convert type 'MyNamespace.Foo... | Sealed keyword affects the compiler 's opinion on a cast |
C_sharp : I 'm using Lidgren and for every new type of message I make , I end up writing the same kind of code . I 'm creating an instance of NetOutgoingMessage , running various assignment calls on it , then sending it when I 'm done . Creation and send are the same , so I want to write a wrapper to do this for me , b... | Something similar to `` using '' that will create an object and call a method on it when done , but let me do what I want in between |
C_sharp : Is this code even complex enough to deserve a higher level of abstraction ? <code> public static JsonStructure Parse ( string jsonText ) { var result = default ( JsonStructure ) ; var structureStack = new Stack < JsonStructure > ( ) ; var keyStack = new Stack < string > ( ) ; var current = default ( JsonStruc... | How could I refactor this into more manageable code ? |
C_sharp : Let 's say I have a method as follows : But the above code has two lookups in the dictionary : The test for the existance of the keyThe actual retrieval of the valueIs there a more optimal way to phrase such a function , so that only one lookup is performed , but the case of `` not found '' is still handled v... | C # optimal IDictionary usage for lookup with possibility of not found |
C_sharp : I 'm using ProtoBuf.NET to serialize/deserialize some classes . I 'm finding that on deserializing , I 'm getting a corrupt byte [ ] ( extra 0 's ) . Before you ask , yes , I need the *WithLengthPrefix ( ) versions of the ProtoBuf API since the ProtoBuf portion is at the starts of a custom stream : ) Anyway ,... | ProtoBuf corrupts byte array during deserialization ( extra 0 's added ) |
C_sharp : If you are coding C # inside visual studio , and you have a multiline comment , thusly : Then if you are inside the comment , like after the word `` comment '' in my example , and you hit enter , Visual Studio adds a `` * `` on the new line and places your cursor even with the `` * '' that started the comment... | Prevent Visual Studio from adding extra asterisks when hitting enter inside a multiline comment |
C_sharp : I want to achieve that I can subdivide a Bezier Curve with a given distance . Now it works if the Bezier is a straight line , but if I change a Controll-Point ( B & C ) so the Bezier get 's curved , the gap between the calculated Points are no more like the given Distance ! I 've look through the web , but di... | Subdivide Bezier Curves |
C_sharp : Based on my understanding , given a C # array , the act of iterating over the array concurrently from multiple threads is a thread safe operation.By iterating over the array I mean reading all the positions inside the array by means of a plain old for loop . Each thread is simply reading the content of a memo... | Is iterating over an array with a for loop a thread safe operation in C # ? What about iterating an IEnumerable < T > with a foreach loop ? |
C_sharp : I thought T ? is just a compiler shorthand for Nullable < T > . According to MSDN : The syntax T ? is shorthand for Nullable < T > , where T is a value type . The two forms are interchangeable.However , there is a little ( insignificant ) difference : Visual Studio does n't allow me to call static methods on ... | Why is it impossible to call static methods on Nullable < T > shorthands ? |
C_sharp : I have existing ap.net c # website is working with mysql database . now i am planning to create mobile app for that website for that API needs to be ready.I am creating an API into PHP Laravel Framework . for RegistrationAPI needs to generate password.Asp.net using its inbuilt library for generating password ... | How to Generate ASP.NET Password using PHP |
C_sharp : All , I have a method that is currently used to invoke DLLs of return type bool , this works great . This method isNow , I want to extend this method so that I can retrieve return values from a DLL of any type . I planned to do this using generics but immediately have gone into territory unknown to me . How d... | Defining Generic Methods |
C_sharp : I have a class called ConfigurationElementCollection < T > It 's a generic implementation of System.Configuration.ConfigurationElementCollectionIt 's stored in our solutions ' , Project.Utility.dll but I 've defined it as being part of the System.Configuration namespaceIs putting classes in the System . * nam... | Is using System . * Namespaces on your own classes considered Bad Practice ? |
C_sharp : We 're using the Stream functionality in RavenDB to load , transform and migrate data between 2 databases like so : The problem is that one of the collections has millions of rows , and we keep receiving an IOException in the following format : This happens quite a long way into streaming and of course transi... | RavenDB Stream for Unbounded Results - Connection Resilience |
C_sharp : In an effort to explore how the C # compiler optimizes code , I 've created a simple test application . With each test change , I 've compiled the application and then opened the binary in ILSpy.I just noticed something that , to me , is weird . Obviously this is intentional , however , I ca n't think of a go... | Variables ending with `` 1 '' have the `` 1 '' removed within ILSpy . Why ? |
C_sharp : While investigating the new features in C # 7.x , I created the following class : And the following test code : If the Person class includes only the SECOND Deconstruct overload , the code compiles and runs fine ( `` Dennis was born a Friday '' ) . But as soon as the first overload is added to Person , the co... | C # deconstruction and overloads |
C_sharp : I have an IEnumerable parameter that is required to be non-empty . If there 's a precondition like the one below then the collection will be enumerated during it . But it will be enumerated again the next time I reference it , thereby causing a `` Possible multiple enumeration of IEnumerable '' warning in Res... | IEnumerable multiple enumeration caused by contract precondition |
C_sharp : I have often wanted to create a list of objects where each object must implement a number of interfaces . For example , I 'd like to do something similar to the following : Another option I considered was to create a third interface that implements these two so that any object that implements these two interf... | Inherently-Implemented Interfaces |
C_sharp : In .NET 4.5 this cipher worked perfectly on 32 and 64 bit architecture . Switching the project to .NET 4.6 breaks this cipher completely in 64-bit , and in 32-bit there 's an odd patch for the issue.In my method `` DecodeSkill '' , SkillLevel is the only part that breaks on .NET 4.6.The variables used here ar... | .Net 4.6 breaks XOR cipher pattern ? |
C_sharp : how to check for duplicate entry on a form using php ? my front end is c # windows applicationI am adding a new user to database using c # and php file.I have created the following : my project in c # ( form1 ) : c # coding : my PHP file : response.phpit add data successfully but when i enter the same userid ... | duplicate entry on database using php |
C_sharp : I 'm making user changeable settings for my media player and I 'm struggling to find an elegant solution to the problem.One of my settings for example - pauses the video at it 's last frame , if not checked it will either continue through the playlist or if it 's only 1 file , reset it and pause it at the sta... | Conditional settings in WPF application |
C_sharp : Let 's assume that our system can perform actions , and that an action requires some parameters to do its work . I have defined the following base class for all actions ( simplified for your reading pleasure ) : Only a concrete implementation of BaseBusinessAction knows how to validate that the parameters pas... | How can I improve this design ? |
C_sharp : I was doing tutorial from this page : http : //msdn.microsoft.com/en-us/library/gg185927.aspxI think I did everything ok but I 'm getting this exception : What I did wrong ? I used certificate from sample . Maybe I should create my own certificate ? Is there any difference ? I noticed that hard coded credenti... | WCF Username Authentication - exception in tutorial |
C_sharp : Why the following program prints ( as it should ) but if we remove keyword 'public ' in class B like so : it starts printing ? <code> BB public class A { public void Print ( ) { Console.WriteLine ( `` A '' ) ; } } public class B : A { public new void Print ( ) { Console.WriteLine ( `` B '' ) ; } public void P... | How method hiding works in C # ? |
C_sharp : The following is a typical implementation of SynchronizationContext.CreateCopy : The MSDN docs are scarce about this method . My questions are : Under what circumstances does it get called by the Framework ? When to implement the actual copy logic , rather than just returning a reference to thesource instance... | The purpose of SynchronizationContext.CreateCopy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.