text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : Current ASAX code ( simplified ) : QuestionIs it safe to pull routes from the DB at this point ? For example : Additional InformationThis question is born out of a lack of knowledge concerning routing as well as a general unfamiliarity with global.asax . In the past , I 've only used global.asax for extremely... | Creating routes from DB records |
C_sharp : I 'm using JSON.NET to deserialize a JSON file to a dynamic object in C # .Inside a method , I would like to pass in a string and refer to that specified attribute in the dynamic object.For example : Where File is the dynamic object , and Key is the string that gets passed in . Say I 'd like to pass in the ke... | Referring to dynamic members of C # 'dynamic ' object |
C_sharp : I am trying to convert a C # Dependency Property that limits the maximum length of text entered into a ComboBox to F # . The program is a MVVM program that uses F # for the model and viewmodel , and C # for the view . the working C # code is this : The F # code is this : The problem I am having is that the XA... | Dependency Property in F # Default Value does not match |
C_sharp : Suppose I do something like Does MyList.OrderBy ( x = > x.prop1 ) return the filtered list , and then does it further filter that list by ThenBy ( x = > x.prop2 ) ? In other words , is it equivalent to ? ? ? Because obviously it 's possible to optimize this by running a sorting algorithm with a comparator : I... | Does LINQ know how to optimize `` queries '' ? |
C_sharp : I have a large array of primitive value-types . The array is in fact one dimentional , but logically represents a 2-dimensional field . As you read from left to right , the values need to become ( the original value of the current cell ) + ( the result calculated in the cell to the left ) . Obviously with the... | Segmented Aggregation within an Array |
C_sharp : I have this kind of code : Foo is a base class and therefor other classes might inherit from it.I would like the OnBar event to always be fired when Bar ( ) is called even if it 's not called explicitly inside Bar.How can it be done ? <code> public class Foo { public SomeHandler OnBar ; public virtual void Ba... | How to invoke an event automatically when a function is called ? |
C_sharp : I 'm checking the sort parameter and building a bunch of if statements : How do I make this better ? <code> if ( sortDirection == `` ASC '' ) { if ( sortBy == `` Id '' ) return customerList.OrderBy ( x = > x.Id ) .Skip ( startIndex ) .Take ( pageSize ) .ToList ( ) ; if ( sortBy == `` FirstName '' ) return cus... | How can I improve this sorting code ? |
C_sharp : We have created a lot of NuGet packages . One of them is a tool , and it contains a special compiler and it is installed like a dotnet tool . The name of the command is `` PolyGen '' .We used a similar mechanism to what Grpc.Tools uses , that means we have defined .targets file inside our NugetPackage . And i... | Execute an action after my nuget package is installed |
C_sharp : I have the need to construct a LINQ To SQL statement at runtime based on input from a user and I ca n't seem to figure out how to dynamically build the WHERE clause.I have no problem with the following : But what I really need is to make the entire WHERE clause dynamic . This way I can add multiple conditions... | How dynamic can I make my LINQ To SQL Statements ? |
C_sharp : I have a list of work items . Each work item has a start and an end time.So , basically it looks like this : Now I want to get the total time that was worked . Again , basically this is easy : It 's just the sum.But now it gets difficult : How do I calculcate this sum if I want to extract parallel times ? E.g... | Get breaks from a list of times |
C_sharp : I 'm a bit of a novice with Reflection . I 'm hoping that it 's possible to do what I 'd like it to . I 've been working through ProjectEuler to learn the language , and I have a base class called Problem . Every individual PE problem is a separate class , i.e . Problem16 . To run my calculations , I use the ... | How can I use reflection or alternative to create function calls programatically ? |
C_sharp : I 'm getting a null exception , but the field was initialized as an empty list . So how could it be null ? The error occurs on the second line in this method ( on _hydratedProperties ) : And this is how the field is declared : This is how it 's set : This is the full class ( with the comments and non-relevant... | How is this field null ? |
C_sharp : According to https : //docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods It is possible to explicitly invoke an interface base implementation with the following syntax.But this does n't seem to be implemented yet.Is there a workaround ( e.g reflection ) t... | C # 8 base interface 's default method invocation workaround |
C_sharp : Since the release of C # 8.0 , I 've really been enjoying the 'void safety ' with nullable reference types . However , while tweaking a library of mine to support the new feature , I stumbled upon a 'problem ' to which I really could n't find an answer anywhere . I 've looked at Microsoft 's release notes and... | .NET Implement IEnumerator with nullable reference types |
C_sharp : C # 8 introduced nullable reference types , which is a very cool feature . Now if you expect to get nullable values you have to write so-called guards : These can be a bit repetitive . What I am wondering is if it is possible to avoid writing this type of code for every variable , but instead have a guard-typ... | Possibility of external functions as nullable guards ? |
C_sharp : I have a class MyClassof which I want to store several instances in a collection . I will often need to check if an instance with a certain name exists , and if it does , retrieve that instance . Since iterating through the whole collection is not an option ( performance ! ) , I thought of a using a collectio... | collection of key-value pairs where key depends on value |
C_sharp : I want to integrate SimpleModal in My ListView edit action so when the user click edit , the modal popup loaded with data through ajax to edit the form .My simple listview : My Bind Code : From FireBug : <code> < asp : ListView ID= '' lv_familyrelation '' runat= '' server '' ItemPlaceholderID= '' RelationCont... | How to use SimpleModal in listView edit action |
C_sharp : I 'm using the RestSharp library to access a REST API.I want all the API requests to go through the same method , so I can add headers , handle errors and do other stuff in a central place.So I made a method that accepts a generic Func < > and that solves most of my problems , but I do n't know how to handle ... | C # Generics and using the non-generic version from typed method |
C_sharp : I wrote the code : and I expect to see in ouput : only short namesor only long namesor names that occur first , after sorting in alphabetical order , which in this case coincides with `` only short names '' .But I did not expect to see what the program showed up : Short name at the end of the output . ¿ Why ?... | How to convert primitive type value to enum value , when enum contains elements with the same values ? |
C_sharp : I hope this is a simple question : How can you change 2 connection strings at runtime in the Global.asax under Application_Start ( ) Web.configGlobal.asaxDetailsBefore I start getting questions as to why I 'm doing this or reasons I should n't , please refer to the following post Azure Key Vault Connection St... | How to Change ConnectionStrings at Runtime for a Web API |
C_sharp : I 'm playing with cqs a little bit and I 'm trying to implement this in a class library ( so there 's no IOC , IServiceProvider , etc ) . Here is some code that I wrote : And this si how I am calling my code : But the problem is that inside the dispatcher , I do n't know why the variable handler can not be ca... | some confusion with generic types in c # |
C_sharp : Consider we have a class with event declared : Despite of `` publicness '' of the event , we can not call FooBarEvent.Invoke from outside.This is overcame by modyfing a class with the following approach : Why accessing public events outside is limited by adding and removing listeners only ? <code> public clas... | Why public event can not be invoked outside directly ? |
C_sharp : I 'm new to Stack Overflow , but tried to put as much informationI have following class structureI am trying to group list of ItemEntity into MasterEntity . Grouping fileds are Field1 , Field2 and Field3.I have done the grouping so far like belowWith in this group , I want to further split this by actual Item... | Complex Linq Grouping |
C_sharp : I want to translate keys used in JSON to different languages.I 'm aware this seems like nonsense from a technical perspective when designing interfaces , APIs and so on . Why not use English only in the first place ? Well , I did n't write this requirement ; ) The easiest way to achieve this is probably an at... | Different `` translated '' JsonProperty names |
C_sharp : So , I currently have a Board class that is composed of Pieces . Each Piece has a color and a string that describes the kind of piece . It also has a 2d matrix with bits either set on or off , that allows me to know which pixels to paint with the desired color or not.My question is , which class should have t... | Which class has the responsibility of setting Piece 's pixels on a Board ( 2d matrix ) ? The Piece or the Board ? |
C_sharp : I am working on a framework that uses some Attribute markup . This will be used in an MVC project and will occur roughly every time I view a specific record in a view ( eg /Details/5 ) I was wondering if there is a better/more efficient way to do this or a good best practices example.At any rate , I have an a... | Best way to access attributes |
C_sharp : I 've got a code In .net 3.5 expression evaluates as false , but in 4.0 it evaluates as true . My question is why ? and how can i check all of my old ( .net 3.5 ) code to prevent this behaviour ? <code> byte [ ] bytes = new byte [ ] { 0x80 , 1 , 192 , 33 , 0 } ; if ( bytes [ 0 ] ! = 0x80 || ( ( bytes [ 1 ] & ... | Strange difference between .net 3.5 and .net 4.0 |
C_sharp : Is there a way to make the analyzer understand that the variable Bar has a value for the following case ? There is the warning `` Nullable value type may be null . '' for Bar.Value but it obviously ca n't be.I am aware of two ways to avoid the warning . Both have disadvantages : Using Bar.HasValue directly in... | How to avoid irrelevant nullable warning ( without explicit suppression ) |
C_sharp : Is there a way that I can track and intercept calls to values in properties that are auto implemented ? I 'd like to have code that looks a bit like this : Ideally the attribute would be able to intercept changes to the property values . Is this possible ? What I do n't want it to have a second piece of code ... | Track calls to auto implemented properties |
C_sharp : I am very new to EWS and Exchange in general , so not really sure what is the best approach.BackgroundI am trying to set configuration information about a room . I was hoping that the EWS API provided me with a Room object that I can add ExtendedProperties on , however , it appears that rooms are just an emai... | Setting ExtendedProperties related to a Room |
C_sharp : Why the following codeprints `` msg '' and this onedoes n't print anything ? <code> class ClassA { public delegate void WriteLog ( string msg ) ; private WriteLog m_WriteLogDelegate ; public ClassA ( WriteLog writelog ) { m_WriteLogDelegate = writelog ; Thread thread = new Thread ( new ThreadStart ( Search ) ... | A Question About C # Delegates |
C_sharp : Given code similar to the following ( with implementations in the real use case ) : Everything works great with a plain foreach ... e.g . the following compiles fine : We can also compile code to feed all the hungry animals : ... but if we try to use similar code changes to make only the hungry dogs bark , we... | Linq functions give strange compile error when ambiguous use of IEnumerable - possible workarounds ? |
C_sharp : I have a small class called Tank has one public member called Location which is a Rectangle ( a struct ) . When I write : everything works fine , and the tank moves.But after I changed the member to be a property , I can no longer use this syntax . It does n't compile , because the t.Location is now a propert... | How to work with value types in c # using properties ? |
C_sharp : I 'm trying to port Java code to C # and I 'm running into odd bugs related to the unsigned shift right operator > > > normally the code : Would be the equivalent of Java 's : However for the case of -2147483648L which you might recognized as Integer.MIN_VALUE this returns a different number than it would in ... | Unsigned shift right in C # Using Java semantics for negative numbers |
C_sharp : I noticed that some enumerations have `` None '' as a enumeration member.For example what I meanWhy do they use it ? In what cases solution with a none member is more preferable ( less preferable ) ? <code> enum Mode { Mode1 = 1 , Mode2 = 2 , Mode3 = 3 , None = 4 } | Why do some people use `` None '' as enumeration member ? |
C_sharp : I have a jagged double [ ] [ ] array that may be modified concurrently by multiple threads . I should like to make it thread-safe , but if possible , without locks . The threads may well target the same element in the array , that is why the whole problem arises . I have found code to increment double values ... | Concurrent modification of double [ ] [ ] elements without locking |
C_sharp : In c # 7.0 , you can use discards . What is the difference between using a discard and simply not assigning a variable ? Is there any difference ? <code> public List < string > DoSomething ( List < string > aList ) { //does something and return the same list } _ = DoSomething ( myList ) ; DoSomething ( myList... | What is the difference between discard and not assigning a variable ? |
C_sharp : Normally , with value ( struct ) types , comparison with null ( or object types ) will result in a compiler error.However , if I add equality operator overloads on the struct , the comparison with null no longer produces a compiler error : I believe this has something to do with implicit conversion to Nullabl... | Is it possible to suppress implicit conversion from null on a struct with operator overloads ? |
C_sharp : I 'd like your opinion on the following subject : Imagine we have a method that is responsible of achieving one specific purpose , but to do so , it needs the support of an important number of locally scoped objects , many of them implementing IDisposable.MS coding standards say that when using local IDisposa... | Using block galore ? |
C_sharp : I try to load JPEG file and delete all black and white pixels from imageC # Code : After that I try to find unique colors in List by this codeAnd this code produces different results on different machines on same image ! For example , on this image it produces:43198 unique colors on XP SP3 with .NET version 4... | .NET Bitmap.Load method produce different result on different computers |
C_sharp : Assuming a method with the following signatureWhat is it acceptable for toReturn to be if TryXxxx returns false ? In that it 's infered that toReturn should never be used if TryXxxx fails does it matter ? If toReturn was a nulable type , then it would make sense to return null . But int is n't nullable and I ... | What 's the standard behaviour for an out parameter when a TryXxxx method returns false ? |
C_sharp : I 've tried to name Button like that : But I 've seen the error : The token `` - Delete '' is unexpectedHow to include < sign in the Content property of Button ? <code> < Button Content= '' < -Delete '' / > | Can I use sign `` < - '' in Content property of Control ? |
C_sharp : Why does the following output provide incorrect result , Output is { N } rather then { 95.00 } as expected . Am I misunderstanding the concept of escaping { } or doing something wrong with Number format ? <code> int myNumber = 95 ; Console.WriteLine ( String.Format ( `` { { { 0 : N } } } '' , myNumber ) ) ; | String.Format does not provide correct result for number format |
C_sharp : Whats the best way to darken a color until it is readable ? I have a series of titles are have an associated color , but some of these colors are very light and any text drawn in them is unreadable . I 've been messing around with HSB and I ca n't seem to get an algorithm down that darkens the color without m... | C # Best Way to Darken a Color Until Its Readable |
C_sharp : I seemed to have stumbled upon something unusual within C # that I do n't fully understand . Say I have the following enum defined : If I declare an array of Foo or retrieve one through Enum.GetValues , I 'm able to successfully cast it to both IEnumerable < short > and IEnumerable < ushort > . For example : ... | Why can enum arrays be cast to two different IEnumerable < T > types ? |
C_sharp : I 'm writing Android application that connect with ASP.net web service ( C # ,3.5 ) android Application send `` Sign in '' information of the user to web service to verify that if the user is registered or not.here is the [ WebMethod ] which receive the request : SigninPerson is a class which hold user inform... | String Comparsion in ASP.net ( C # ) |
C_sharp : We have to use api from 3rd party vendor ( perforce ) . Till today , we were able to reference and use that API in .net framework application . But , now we are refactoring our product and of course we decided to use new .net environment , which is .net core 2.2 . As , Perforce did n't publish that library fo... | .net standard library fails in .net core but not in framework |
C_sharp : I wrote some code today and It was changed by another developer who said it was more safe . I am not sure this is right as I can not see the advantage of what was done here are some code examplesthis was changed toI am quite new to c # should the stream not be closed when you are finished with it ? <code> pub... | Closing a stream in function , a bad idea ? |
C_sharp : I have a propertygrid which I need to create a combobox inside the propertygrid and display int value ( 1 to 9 ) , I found using enum is the easiest way , but enum could n't display int value , even I try to cast it to int , but I do not know how to return all the value . Any other way to do this ? Thanks in ... | display int value from enum |
C_sharp : I have an issue looping the if-statement in my code . I looked at other threads on stackoverflow but I could n't get it to work multiple times . The program I 'm trying to create is a basic converter for a casting company . What I tried to do is make it so that the user can input the type of conversion needed... | How to loop an if-statement with many else if conditions |
C_sharp : I 'm learning C # generics and making some dummy code for testing purposes . So , I 'm testing the in Generic Modifier , which specifies that the type parameter is contravariant.Given the below interface : When compiling , I 'm getting the error message : [ CS1961 ] Invalid variance : The type parameter 'T ' ... | Using generic contravariant with IList and IEnumerable |
C_sharp : I got two sets of numbers , with SET2 having more items in it usually . It 's guaranteed that the count of SET2 is equal or greater than the count of SET1 . Acutally , since the order matters the input are rather lists than sets.My goal is to combine ( sum up ) / reorder the numbers from SET2 to make it as si... | Finding a good match of two lists of numbers |
C_sharp : I have couple of classes that are identified by some ID ( which is unique integer for every class ) . Next I need a method which takes an integer ( ID ) as argument and return corresponding class type . So far I have come to this : For now it seems that it works , but for some reason I do n't like that I have... | C # method to return a type |
C_sharp : I was reading a C # book in which the author ( some dude named Jon Skeet ) implements a Where function like Now , I fully understand how this works and that it 's equivalent to which brings up the question of why would one separate these into 2 functions given that there would be memory/time overhead and of c... | Separate functions into validation and implementation ? Why ? |
C_sharp : I need to continuously read a log file to detect certain patterns . How can do so without interfering with file operations that the log writer operation needs to perform ? The log writer process , in addition to writing logs , periodically moves the file to another location ( one it reaches certain size ) .Wi... | Read a file in such a way that other processes are not prevented from modifying it |
C_sharp : My colleague and I came across this when looking into getting the invocation list of a delegate . If you create an event in say class X , then you can access the public methods of the event fine from within that class . But ( and please ignore stuff like why you 'd have public access to class members , this i... | How to make public methods only visible in class itself and class owning the object in C # ? |
C_sharp : Boxed nullable underlying type can be cast to enum but boxed enum type ca n't be cast to nullable type.And similarly , Boxed nullable enum can be cast to underlying type but boxed underlying type ca n't be cast to nullable enum.Ok , I know `` boxed nullable type '' is not the best way to describe it , but it ... | Boxed nullable underlying type can be cast to enum but boxed enum type ca n't be cast to nullable type |
C_sharp : This code after compilation looks like this in ILSpy : Why does it happen and can it be the reason of regex not matching in .Net 3.5 ? On 4.5 it works . <code> Regex regex = new Regex ( `` blah '' , RegexOptions.Singleline & RegexOptions.IgnoreCase ) ; Regex regex = new Regex ( `` blah '' , RegexOptions.None ... | Why RegexOptions are compiled to RegexOptions.None in MSIL ? |
C_sharp : I have the following simple codeWhen I ran this code the line Test ( ( Int32 ) 1 ) causes stack overflow due to infinite recursion . The only possible way to correctly call proper method ( with integer parameter ) I found isBut this is not appropriate for me , because both methods Test are public and I am wil... | How to call overridden method which have overloads ? |
C_sharp : I want to generate triangles from points and optional relations between them . Not all points form triangles , but many of them do.In the initial structure , I 've got a database with the following tables : Nodes ( id , value ) Relations ( id , nodeA , nodeB , value ) Triangles ( id , relation1_id , relation2... | Forming triangles from points and relations |
C_sharp : I 'm processing lots of data in a 3D grid so I wanted to implement a simple iterator instead of three nested loops . However , I encountered a performance problem : first , I implemented a simple loop using only int x , y and z variables . Then I implemented a Vector3I structure and used that - and the calcul... | Why is using structure Vector3I instead of three ints much slower in C # ? |
C_sharp : I know that we can use a format specifier for string interpolation in C # 6However I am using the same format in the same method over and over again so would like to soft code it , but not sure how to do it , or even if its possible , Can someone tell me how to do it , or confirm to me its impossible as I hav... | Soft coding format specifier for Interpolated strings c # 6.0 |
C_sharp : I 've got some code that has an awful lot of duplication . The problem comes from the fact that I 'm dealing with nested IDisposable types . Today I have something that looks like : The whole nested using block is the same for each of these methods ( two are shown , but there are about ten of them ) . The onl... | How could one refactor code involved in nested usings ? |
C_sharp : I work with resharper and when I clean my code I get this layout : I 'd rather have : is this possible ? <code> mock.Setup ( m = > m.Products ) .Returns ( new List < Product > { new Product { Name = `` Football '' , Price = 25 } , new Product { Name = `` Surf board '' , Price = 179 } , new Product { Name = ``... | resharper inline object initialisation |
C_sharp : I want to perform the updation of the existing record.. the way that i have paste my code here i have successfully achieved my task but i dont want to do the updation by that way actually.. i want to do such that i get the id of the customer.. <code> private void btnUpdate_Click ( object sender , EventArgs e ... | A question regarding C # and SQL |
C_sharp : consider the variable ob4 as shown in figurenow : how can i reach ob4 [ 0 ] - > [ 0,2 ] the line ( double [ , ] p= ( double [ , ] ) o [ 0,0 ] ; ) gives the following error : Can not apply indexing with [ ] to an expression of type 'object ' <code> var o=ob4 [ 0 ] ; double [ , ] p= ( double [ , ] ) o [ 0,0 ] ; | Working with object |
C_sharp : I have a WinForms project which is several years old and has been retro-fitted with async event-handlers : Inside this method is an async call : When the program runs on a normal resolution screen , it runs as expected . However , when run on a high-DPI screen the window 's dimensions - as well as those of al... | WinForms window changes dimensions when it encounters an async call |
C_sharp : I got a little problem with reading information from an xml file ... The file passed to me has thousands of lines . Im interested in only 300 - 400 of those lines . I do n't need to write any data back to xml when the user is finished with his operation and the data to read can be stored in a List < string > ... | Read xml from file |
C_sharp : I 've got a number of classes designed to handle objects of specific types.e.g. , where the handler interface might be defined something like this : Now , I 'd like to be able to use a dictionary of these handlers : However , C # does n't appear to allow me to use the Handler interface without specifying a ty... | Is it possible to do an unsafe covariant invocation of a generic method ? |
C_sharp : I 've been experimenting with Linq to see what it can do - and I 'm really loving it so far : ) I wrote some queries for an algorithm , but I did n't get the results I expected ... the Enumeration always returned empty : case # 1I changed the query declaration to be inline like this , and it worked fine : cas... | Linq deferred execution with local values |
C_sharp : Why does the following not compile ? The compiler complains that `` The name 'FooMethod ' does not exist in the current context '' . However , if the Foo method is changed to : this compiles just fine.I do n't understand why one works and the other does not . <code> interface IFoo { void Foo ( ) ; } class Foo... | Why does a method prefixed with the interface name not compile in C # ? |
C_sharp : I am looking for a way to generate N pieces of question marks joined with comma.EDIT 1 I am looking in a simple way . Probably using 1-2 line of code . In c++ there are array fill ( ) and joins.EDIT 2I need this for Compact Framework <code> string element= '' ? `` ; string sep= '' , '' ; int n=4 ; // code to ... | How can create N items of a specific element in c # ? |
C_sharp : The code below works for me however , I would like to add a condition before it is added to the table . What I need is - if the `` Scan Time '' is between two dates , then it should be added to the `` table '' if not , then it should be disregarded.This is for selecting the file.. This is for reading the file... | Exploding a lambda expression |
C_sharp : I have an interface with a covariant type parameter : Additionally , I have a non-generic base class and another deriving from it : Covariance says that an I < Derived > can be assigned to an I < Base > , and indeed I < Base > ib = default ( I < Derived > ) ; compiles just fine.However , this behavior apparen... | Covariance error in generically constrained class |
C_sharp : Can anyone shed light on why contravariance does not work with C # value types ? The below does not work <code> private delegate Asset AssetDelegate ( int m ) ; internal string DoMe ( ) { AssetDelegate aw = new AssetDelegate ( DelegateMethod ) ; aw ( 32 ) ; return `` Class1 '' ; } private static House Delegat... | Contravariant Delegates Value Types |
C_sharp : VB.Net code that I need to translate to C # : Same equation in C # Why is there a different ? Is Mod different between the two ? EDIT : I am translating code from VB to C # , so I need to get the same result as the VB code in my C # code . <code> Dim s = 27 / 15 Mod 1 //result is 0.8 var s = 27 / 15 % 1 //res... | C # and VB.Net give different results for the same equation |
C_sharp : I need to download from FTP over 5000 files being .html and .php files . I need to read each file and remove some stuff that was put there by virus and save it back to FTP.I 'm using following code : I downloaded some files by hand and some have < meta http-equiv= '' Content-Type '' content= '' text/html ; ch... | Can a file be read and written right back with small changes without knowing its encoding in C # ? |
C_sharp : This is minor , I know , but let 's say that I have a class Character and a class Ability ( mostly because that 's what I 'm working on ) . Class Character has six abilities ( so typical D & D ... ) . basically : andWhen actually using these ability properties in future code , I 'd like to be able to default ... | How to create a simplified assignment or default property for a class in C # |
C_sharp : I noticed the following code from our foreign programmers : It 's not exactly proper code but I was wondering what exactly this will do . Will this lock on a new object each time this method is called ? <code> private Client [ ] clients = new Client [ 0 ] ; public CreateClients ( int count ) { lock ( clients ... | New inside a lock |
C_sharp : I have the follow button click event : Effectively , it does a few checks and then starts some directory recursion looking for specific files . However , the very first line of code to make the label visible does not occur until after the directories have been recursed ? Anybody know why this would be ? Thank... | C # - Code processing order - strange behaviour |
C_sharp : LINQ to NHibernate removes parenthesis in where clause : This results in the following query ( note the missing parenthesis ) : This is a huge problem , because it changes the query condition significantly.Is this a known problem or am I doing something wrong ? <code> session.Query < MyEntity > ( ) .Where ( x... | Grouping in condition is being dropped |
C_sharp : I have simplified my code to thisThe issue is that this calls although I am calling it with an int and it should be using Using the parent returns the expected result.Update : Thanks to @ Jan and @ azyberezovsky for pointing me to the specification . I have added a virtual empty method to the base class to ge... | Derived class using the wrong method |
C_sharp : Any ideas ? I marked it as static but it 's not working ! <code> class ExtensionMethods { public static int Add ( this int number , int increment ) { return number + increment ; } } | I can not get my extension method to work ( C # ) |
C_sharp : This question relates to DocumentClient from Microsoft.Azure.DocumentDB.Core v2.11.2 . ( Update : the bug also exists in Microsoft.Azure.Cosmos . ) There seems to be a bug in the LINQ Provider for Cosmos DB when the query contains DateTime values with trailing zeros . Consider the following piece of code : Th... | Bug in DateTime handling of Cosmos DB DocumentClient |
C_sharp : Example code : Code at line C wo n't compile , but line A compiles fine . Is there something special about an enum with 0 value that gets it special treatment in cases like this ? <code> public enum Foods { Burger , Pizza , Cake } private void button1_Click ( object sender , EventArgs e ) { Eat ( 0 ) ; // A E... | Enum 0 value inconsistency |
C_sharp : I have seen some form of this some time ago , but I can not recall what it was called , and therefore have no clue on how to implement something like this : Which calls some overload function that can parse the string into a SomeMoneyFormat object . <code> SomeMoneyFormat f = `` € 5,00 '' ; | What 's this syntax called ? SomeMoneyFormat f = `` € 5,00 '' ; |
C_sharp : So I am trying to Unit test/Integration test my code responsible for sharing a directory.So I create my share drive and then I check if the directory exists . First locally and then via it 's share name.After this I of course want to clean up after myself by removing the directory I just created . However thi... | Directory.Exists hold directory handle for several seconds |
C_sharp : Let 's say I have this text input.I want to extract the ff output : Currently , I can only extract what 's inside the { } groups using balanced group approach as found in msdn . Here 's the pattern : Does anyone know how to include the R { } and D { } in the output ? <code> tes { } tR { R { abc } aD { mnoR { ... | How to make balancing group capturing ? |
C_sharp : I 'm need to convert some string comparisons from vb to c # . The vb code uses > and < operators . I am looking to replace this with standard framework string comparison methods . But , there 's a behaviour I do n't understand . To replicate this , I have this testCould someone explain why b is returning 1 . ... | Understanding String Comparison behaviour |
C_sharp : In the below piece of C # code , why does the first set of prints produce an output of C C C but the LINQ equivalent of that produces an output of A B C I understand the first set of outputs - it takes last value when it exits the loop , but seems to me that there should be consistency between the traditional... | Traditional loop versus LINQ - different outputs |
C_sharp : Possible Duplicate : Why are private fields private to the type , not the instance ? Consider the following class : In my constructor I 'm calling private or protected stuff of the otherObject . Why is this possible ? I always thought private was really private ( implying only the object could call that metho... | Why is calling a protected or private CSharp method / variable possible ? |
C_sharp : I am creating a save game manager for Skyrim and have run into an issue . When I create a SaveGame object by itself , the bitmap portion of the save works correctly . When I call that method in a loop , however , the bitmap takes on an erroneous value , mainly one that is similar to that of another save game.... | Why does the data in a bitmap go out of scope ? |
C_sharp : I 'm building an application that saves named regular expressions into a database . Looks like this : I 'm using Asp.Net forms . How can I validate the entered regex ? It would like the user to know if the entered regex is not a valid .Net regular expression.The field should reject values like : <code> ^Wrong... | How to validate if the input contains a valid .Net regular expression ? |
C_sharp : I am trying to generating the usps label with 4x6 but I am facing this issue . Can any one help me out for generating 4x6Label.Also I tried changing the version from DeliveryConfirmationV3 to DeliveryConfirmationV4 but still it is not generating 4x6Label.My xml request is passing as but I am receiving error a... | Issue as The element 'ImageParameters ' can not contain child element 'ImageParameter ' |
C_sharp : I salted and hashed my logins according to this Code Project articleWhen I did this , my password and salt fields in the database were just varchar columns . The data was displayed in SQL Server Management Studio as question marks.A friend then came and changed the columns to nvarchar data type and now the da... | Password hashing used to work , now I ca n't get into my software |
C_sharp : I 'm consuming a SOAP web service . The web service designates a separate service URL for each of its customers . I do n't know why they do that . All their functions and parameters are technically the same . But if I want to write a program for the service I have to know for each company is it intended . Tha... | `` using '' of two different libraries with almost identical functions |
C_sharp : Why must we specify the parameter name x as followswhen declaring a delegate type ? For me , the parameter name x is unused so it will be simpler if we can rewrite as follows : Please let me know why the C # designer `` forced '' us to specify the parameter names.Edit1 : Is public delegate TResult Func < T1 ,... | By design why is it mandatory to specify parameter names when declaring delegate type ? |
C_sharp : I 'm working on an algorithm which calculates a similarity coefficient between restaurants . Before we 're able to calculate said similarity , I need 3 users who rated both restaurants . Here is a table with a possible scenario as example : Here does X stand for no review , and the ratings are reviews from a ... | Matching users who reviewed the same restaurants |
C_sharp : The output of the below code is as following : not equalequal Note the difference in type of x and xx and that == operator overload is only executed in the second case and not in the first.Is there a way I can overload the == operator so that its always executed when a comparison is done on between MyDataObej... | == operator overloading when object is boxed |
C_sharp : Both the strings s5 and s6 have same value as s1 ( `` test '' ) . Based on string interning concept , both the statements must have evaluated to true . Can someone please explain why s5 did n't have the same reference as s1 ? <code> string s1 = `` test '' ; string s5 = s1.Substring ( 0 , 3 ) + '' t '' ; strin... | Why some identical strings are not interned in .NET ? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.