text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : Here is the relevant code . Mind you , I did this in Notepad++ instead of copying in my code for my project at work . If I misspelled a class name in it , assume it is not misspelled in my code . No compile errors.Model : Controller : View ( Razor ) : This will `` work '' , but wo n't set values on any of the... | Correct way to use DropDownListFor with a list of primitive types ? |
C_sharp : I have many entities that have the IsActive property . For internal reasons , I need all those fields to be nullable . On the other hand , for every entity I may have to do a double test in tens of places in the application : ( null are treated as true ) If I create a method likeIt still wo n't hide the prope... | Avoiding to repeatedly test for nulls on the same properties |
C_sharp : I use dotMemory to profile my application and I noticed the below behavior : inside my code there are some points where I perform garbage collection manually by using Inside dotMemory I see that memory is actually freed in these points but if after that I click 'Force GC ' even more garabage is collected . Wh... | What exactly happens when I ask dotMemory to force garbage collection |
C_sharp : Is it possible for a constructor to be pre-empted in C # ? For example , consider the code : Somewhere else in the code two threads have access to a variable of type A , the first thread calls the constructor which is pre-empted at point # 1 . Then the second thread tests for ready and finds it to still be tr... | Can a constructor be pre-empted ? |
C_sharp : I wanted to learn more about C # language and a lot of people have recommended digging into the C # specification , so I went and downloaded a copy of it from MSDN and started reading and going through the examples.C # Specification Introducton - Section 1.6.7.5 Operators `` The List class declares two operat... | C # Specification - Section 1.6.7.5 can someone please explain this example ? |
C_sharp : What is the difference between the following two snippets of code : andI have started using using a lot more but I am curious as to what the actually benefits are as compared to scoping objects.Edit : Useful tidbits I took from this : Jon Skeet : Note that this does not force garbage collection in any way , s... | Difference between 'using ' and scoping ? |
C_sharp : I have function in c++ something like this : And I can use functions in two ways : When I write code in C # I used ref keyword : but compiler said : A ref or out parameter can not have a default value.How can I solve this problem ? <code> // C++bool Foo ( int* retVal = NULL ) { // ... if ( retVal ! = NULL ) *... | How to convert optional pointer argument from C++ code to C # |
C_sharp : Given the code : Inputting the value 0x300 yields the result 0x69D04700 . This is only the lower 32 bits of the result.Given the result 0x69D04700 and the factor 0x123456D , is it possible to retrieve all numbers such that ( value * 0x123456D ) & 0xFFFFFFFF = 0x69D04700 in a fast way ? Edit : The code I show ... | Reversing multiplication operation that has overflowed |
C_sharp : I have the following LINQ query : Which translates to the following when run : Now I 'm pretty sure that the reason there is a sub-select is because I have the base LINQ query surrounded by ( ) and then perform .Distinct ( ) but I do n't know enough about LINQ to be sure of this . If that 's indeed the case i... | Why does LINQ-to-Entities put this query in a sub-select ? |
C_sharp : Can anyone explain , why does the following code produce the error ? ( Compiling in Microsoft Visual Studio 2008 ) the error is The call is ambiguous between the following methods or properties : 'ConsoleApplication1.Program.M1 < ConsoleApplication1.Base1 > ( ConsoleApplication1.Base1 , ConsoleApplication1.I1... | Why is this call ambiguous ? |
C_sharp : I 'm confused why this compiles : MyDelegate should be a pointer to a method that takes two int parameters and returns another int , right ? Why am I allowed to assign a method that takes no parameters ? Interestingly , these does n't compile ( it complains about the signature mismatches , as I 'd expect ) Th... | Why does a delegate with no parameters compile ? |
C_sharp : ( Note : I already asked this question , but the answer was specific to Java , and so I am asking the same question for C # and the .NET framework . It is NOT a duplicate . ) I have been using this pattern for a while , but I only recently came to think that it might not be OK to do this . Basically , I use s... | Are unresettable `` flags '' threadsafe in C # /.NET ? |
C_sharp : I have the following recursive code and i am getting a stackoverflow exception . I ca n't figure out the root cause because once i get the exception , i dont get the full call stack in Visual studio.The idea is that there are org teams that roll up into larger `` Main '' teams.Does anyone see a flaw on this c... | how can i get catch the root of a stackoverflow exception on recursive code |
C_sharp : If I have a task running on a worker thread and when it finds something wrong , is it possible to pause and wait for the user to intervene before continuing ? For example , suppose I have something like this : Is it possible to substitute WaitForUserInput ( ) with something that runs on the UI thread , waits ... | How to pause task running on a worker thread and wait for user input ? |
C_sharp : Possible Duplicate : C # Captured Variable In Loop I am pretty new to multi-threading programming.When I ran the code below and only the last child got executed.Can some one tell me what happened ? Thank you very much.Output <code> private void Process ( ) { Dictionary < int , int > dataDict = new Dictionary ... | Confused about multi-threading in a loop for C # |
C_sharp : The loop : It just does a repeated find-and-replace on a bunch of keys . The dictionary is just < string , string > .I can see 2 improvements to this . Every time we do pattern.Replace it searches from the beginning of the string again . It would be better if when it hit the first { , it would just look throu... | How can I speed this loop up ? Is there a class for replacing multiple terms at at time ? |
C_sharp : To follow my previous post here = > Binding SelectedItem of ComboBox in DataGrid with different typeI have now a datagrid containing 2 columns , one with a text , the other with a combobox ( in a datatemplate , written thru the C # code , not the Xaml ) . After having done some choice on the combobox , I now ... | How to get value of a programmatically written combobox in a datagrid in wpf ? |
C_sharp : I am trying to understand one thing in this code : And Output is : And the thing that I do n't understand when you pass null to y , I believe it calls public static implicit operator Nullable < T > ( T value ) but the definition of this method initializes a new struct passing value which is assigned null howe... | How CLR can bypass throwing error when assigning a null value to the struct ? |
C_sharp : I use private and public methods all the time . However , I do not understand why they work.Creating a small Hello World Program : The IL created for the public method : The IL created for the private method : It 's the exact same.How does the JIT differentiate and verify that the private/public rules were fo... | How does C # verify the C # Private Definition ? |
C_sharp : I 'm having a problem . I 'm making a utility to do procedural generated maps.I have a room pool and each rooms are disposed in a table of room . I have a method to connect all the room together which walk in the table and connect adjacent rooms . I have an enum which contains the type of rooms : In the conne... | If statement always true with enum in comparison |
C_sharp : I have a C # app . In this app , I have some XML that looks like this : I 'm trying to convert this XML into a C # object . My class looks something like this : When I run var list = List.Deserialize ( xml ) ; I get a List object back . The name of the List is properly set . However , the Items property is nu... | C # - Xml Deserialization of KeyValueConfigurationCollection |
C_sharp : I have been trying to read data from the Twitter stream API using C # , and since sometimes the API will return no data , and I am looking for a near-realtime response , I have been hesitant to use a buffer length of more than 1 byte on the reader in case the stream does n't return any more data for the next ... | Consuming a HTTP stream without reading one byte at a time |
C_sharp : Is there a way to mark a type ( or even better , an interface ) so that no instances of it can be stored in a field ( in a similar way to TypedReference and ArgIterator ) ? In the same way , is there a way to prevent instances from being passed through anonymous methods and -- In general -- To mimic the behav... | Make type 's instances non-storable |
C_sharp : [ Edit : It looks like the original question involved a double and not an integer . So I think this question stands if we change the integer to a double . ] I have rare issue with reading integer properties from a class used in multiple threads that sometimes returns a zero value . The values are not changed ... | What is a best practice for making a class 's properties thread safe ? |
C_sharp : For example , consider this : The eventStream is a long lived source of events . A short lived client will use this method to subscribe for some period of time , and then unsubscribe by calling Dispose on the returned IDisposable.However , while the eventStream still exists and should be kept in memory , ther... | Do 'Intermediate IObservables ' without final subscribers get kept in memory for the lifetime of the root IObservable |
C_sharp : The above compiles , but ... Does not.Replacing it with : Will obviously compile though . Is this inconsistancy or am i being stupid , or am i just wrong : S . <code> private string [ ] GetRoles ( ) { string [ ] foo = { `` Test '' } ; return foo ; } private string [ ] GetRoles ( ) { return { `` Test '' } ; } ... | Inconsistent syntax c # ? |
C_sharp : I work for myself , I am a self-employed coder and as a result I do n't have the luxury of code reviews or the ability to improve based upon peer programming . I am going to use this as an exercise to see if the StackOverflow community might help to review a simple method which i 've written ; This is a metho... | Refactor for Speed : Convert To a Date |
C_sharp : I have the following C # code which initializes a new dictionary with int keys and List < string > values : If I decompile an executable made from this snippet back to C # the corresponding part looks like this : Everything seems normal and is working properly here.But when I have the following code : which a... | Dictionary initializer has different behavior and raises run-time exception when used in combination of array initializer |
C_sharp : Suppose I initialize members of a class like this : Does the compiler generate a default constructor in this situation ? In general , I know that a constructor may initialize the value of class instance variables and may also perform some other initialization operations appropriate for the class . But in the ... | In C # , is a default constructor generated when class members are initialized ? |
C_sharp : I 'm writing a bunch of unit tests for my ASP.NET MVC app using Entity Framework ( against a SQL Server database ) .I 'm using Rowan Miller 's excellent Nuget packages `` EntityFramework.Testing '' and `` EntityFramework.Testing.Moq '' to allow me to unit test EF code ( without actually having a real SQL Serv... | Unit-testing EF 's state management code |
C_sharp : This is a constructor in one of my classes : The Code Contracts static checker flags an error : warning : CodeContracts : ensures is false : PrereleaseVersion ! = nullMaybe < T > is a collection containing zero or one elements.As far as I can see , the only way that can be null is if there 's an exception bef... | Why does Code Contracts claim that `` Ensures is false '' for this code ? |
C_sharp : I 'm trying to convert this C # code to C++ : Pretty clear this calls for std : :function . Since this is a larger project I used a tool to do all the conversion and this is what it came up with : I assumed using std : :function < void ( ) > is a translation error , so I changed them to Action . So , my final... | C # to C++11 conversion : delegate templates |
C_sharp : I am trying to setup blazor server side but I keep getting this problem when trying to install itfollowing this tutorial from microsoft and I get this error in powershell window <code> PS D : \blazorTesting > dotnet new blazorserverside -o WebApplicationServerSideUsage : new [ options ] Options : -h , -- help... | Unable to determine the desired template from the input template name : blazorserverside |
C_sharp : I wrote the following test ( actually used in a wider context ) Why does n't the task manager show any sign of the allocated 100 megabytes before the first key press ? If this is by design , how else can I test the consumption of unmanaged heap memory ? <code> IntPtr x = Marshal.AllocHGlobal ( 100000000 ) ; C... | Unmanaged memory not showing up in task manager |
C_sharp : I was perusing the .Net Reference Source and found this gem in ButtonBase.cs at line 408 : Question being , what would motivate someone to use the exceptionThrown flag over just writing it as Is it just stylistic or is there some side-effect I am missing ? <code> bool exceptionThrown = true ; try { OnClick ( ... | Is there a reason for using Try/Finally with ExceptionThrown variable over Try/Catch |
C_sharp : In C # , will the folloing code throw e containing the additional information up the call stack ? <code> ... catch ( Exception e ) { e.Data.Add ( `` Additional information '' , '' blah blah '' ) ; throw ; } | Exception throwing |
C_sharp : I have looked , but could n't find a definitive answer for some of my exception questions , especially regarding C # best practices.Perhaps I will always be confused about the best way to use exceptions , I ran across this article which basically says 'always use exceptions , never use error codes or properti... | Mixing errors and exceptions in C # |
C_sharp : I want to make an SS application . But I have problem on this subject . I want user to be able to select a special area to take screenshot . I also want the desktop is live while the user is selecting the area . For example user wants to take an SS of a video 's specific frame . The user must be able to do th... | How to do a screenshot area selection by drawing on desktop to take screenshot ? |
C_sharp : I have a rather simple LDAP client that works ok when connecting to the 389 port ( LDAP ) but fails with a `` LDAP server unavailable '' when I try to connect to the 636 port ( LDAPS ) .If I add the following at [ CODE MODIFICATION HERE ] to accept all server certificates , it works : The certificate is signe... | .Net program does not get validated server certificate |
C_sharp : The documentation of constant pattern matching with the is-operator ( expr is constant ) states : The constant expression is evaluated as follows : If expr and constant are integral types , the C # equality operator determines whether the expression returns true ( that is , whether expr == constant ) .Otherwi... | Why does the is-operator cause unnecessary boxing ? |
C_sharp : I have a class of 3 different linked lists ( for saving the entities in a game I 'm working on ) . The lists are all of objects with the same base type , but I keep them separate for processing reasons . Note that IEntity , IObject and IUndead all inherited from IEntity.I have 3 methods for retrieving each of... | C # , generic way to access different lists within a class |
C_sharp : We had a bit of an incident today which has got me thinking . We have a project with a pretty standard web.config transform setup for our various configs . There is a section which controls access to our DAO services which looks like this : And a transform like this : Hopefully you will have spotted the error... | Failing web.config transform when no value exists for a transform |
C_sharp : I 'm working on a project where the MongoDB model will be similar to Facebook . So we all know how FB works , a user `` likes '' a band/company page , and that user will see all the posts from that page.Is the below model how I should design this ? If a Page has million likes , then each Post will have a mill... | C # mongodb model like Facebook |
C_sharp : I 'm attempting to use CryptUnprotectData to read a password protected using CryptProtectData into a SecureString and use that to connect to a database . I can get the correct password out , but trying to create a new SqlConnection after that fails with the following : It 's enough to simply call CryptUnprote... | P/Invoke CryptUnprotectData breaks SqlConnection constructor |
C_sharp : IEnumerable does not guarantee that enumerating twice will yield the same result . In fact , it 's quite easy to create an example where myEnumerable.First ( ) returns different values when executed twice : This is not just an academic example : Using the popular from ... in ... select new A ( ... ) will crea... | Is there a canonical way to `` fix '' a `` dynamic '' IEnumerable ? |
C_sharp : I have a Windows Forms application where I need to make all fonts of all UI elements configurable from a separate file . I.e . I want to be able to specify that a label has a font `` TitleBarBoldFont '' which would resolve to a real font , depending on the current locale . The configuration file may contain a... | Looking for the optimal way to use custom font definitions in WinForms application |
C_sharp : suppose this is my txt file : im reading content of this file with : Now i want to read data in stdList , but read only value every 2 line ( in this case i 've to read `` line2 '' and `` line4 '' ) .can anyone put me in the right way ? <code> line1line2line3line4line5 string line ; List < string > stdList = n... | reading string each number c # |
C_sharp : This is a question for a job application : '' A father has two sons and 999 paintings . Each painting has a different value : first is worth 1 , second is worth 2 and so on , until the final painting is worth 999 . He would like to divide all of his paintings to his two sons , so that each son gets equal valu... | Father , two sons , 999 paintings |
C_sharp : I 'm trying to load some .dll files dynamically . The Files are Plugins ( self-written for now ) which have at least one class that implements MyInterface . For each file I 'm doing the following : Running this causes a cast exception , but I ca n't find a workaround . Anyway I am wondering why this does n't ... | C # cast a class to an Interface List |
C_sharp : I 'm currently working on some C # /C++ code which makes use of invoke . In the C++ side there is a std : :vector full of pointers each identified by index from the C # code , for example a function declaration would look like this : But now I 'm thinking , since I 'm working with pointers could n't I sent to... | Is it safe to keep C++ pointers in C # ? |
C_sharp : I have seven words in the array : the x is generated from another array : that means each x can be either a or b or c or d. It is randomly generated . this could be an example : my question is how can I check if there are five x which has the same value ? This is for a poker app Im working on . <code> string ... | Compare 7 words to eachother to see if 5 of them are equal . How ? |
C_sharp : I have a C # app that uses a custom section for configuration . I have that section of XML defined as a string . The string looks like this : This XML matches the schema defined by the classes I described here . When I pass the above string to the Departments.Deserialize method , I receive an error . The erro... | Unable to Deserialize XML in C # - Unrecgnized element 'add ' |
C_sharp : I am developing a windows application using c # . I am loading a file ( html , txt , xhtml ) to the text box . I want to test the occurrence of following cases in my text box.For all the occurrences of the above condition I want to highlight the particular found text in the textbox . I am trying to use the re... | Multiple occurrence of regular expression in a multiline textbox |
C_sharp : I have a strange problem and it 's been frustrating me for the past few hours . I ca n't seem to find anything related ; perhaps I 'm not being specific enough , as I 'm not sure how to word it correctly , or it 's a strangely unique problem.There 's a form a user fills in to update their account information ... | That text area of nullness |
C_sharp : I have the following line of code : Exists on the left hand side is a property of the User class . Its type is just bool , not bool ? . The Exists method on the right hand side is an API method to check if a given entity exists in the repository . It returns Task < bool > . I want to check if the repository i... | Why can the null conditional operator be used when setting the value of a bool without using a nullable bool ? |
C_sharp : Consider the following : The first Write in DoItAsync ( ) executes.SomeLongJobAsync ( ) starts.The WriteLine in DoItAsync ( ) executes.DoItAsync ( ) pauses while SomeLongJobAsync ( ) works away until it 's done.SomeLongJobAsync ( ) completes , so DoItAsync ( ) returns.Meanwhile , the UI is responsive.On what ... | Where do 'awaited ' tasks execute ? |
C_sharp : As you probably know in D language we have an ability called Voldemort Types and they are used as internal types that implement particular range function : Here is how the Voldemort type can be used : Now I want to make sure that , Is this the equivalent to delegate in C # ? <code> auto createVoldemortType ( ... | Voldemort types in C # |
C_sharp : I 'm currently trying to bulkinsert a datatable into a database . It works fine and fast . The only problem occursif there are any rows that are already in the database ( duplicate key ) . To counter this I have modified my program so that I first check for each new entry if it already exists in the database ... | How to fast reduce a datatable according to existing entries in a DB |
C_sharp : This issue has been on/off bugging me and I 've written 4 wrappers now . I 'm certain I 'm doing it wrong and need to figure out where my understanding is branching off.Let 's say I 'm using the Rectangle class to represent bars of metal . ( this works better then animals ) So say the base class is called `` ... | C # base inheritance |
C_sharp : Is there any performance benefit to explicitly calling a method directly from a namespace class library rather than using the namespace ? Here is an example of a situation I 'm referring to : vs . <code> // usingusing System.Configuration ; public class MyClass { private readonly static string DBConn = Config... | Is there a performance difference between using a namespace vs explicitly calling the class from the namespace ? |
C_sharp : Having How can I translate for ( x = 0 ; x < 1ULL < < ( 2*k ) ; ++x ) unsigned long long 1ULL and bitwise to c # ? I was tryingHow to translate that parts of code x < 1ULL < < ( 2*k ) ; and `` ACGT '' [ y & 3 ] ? <code> int i , k ; unsigned long long x , y ; k = 5 ; for ( x = 0 ; x < 1ULL < < ( 2*k ) ; ++x ) ... | translate C unsigned long long and bitwise in for loop to c # |
C_sharp : I would like to know if there 's a specific constraint for numerical types that allows casting to work in the following case : I tried boxing and unboxing like : But this only works if T == byte . Otherwise I get an InvalidCastException.T is always a number type ( like short , float , and so on ) . <code> cla... | Converting numerical concrete type to numerical generic type |
C_sharp : After a bit of programming one of my classes used generics in a way I never seen before . I would like some opinions of this , if it 's bad coding or not.is this an OK use of generics or not ? I 'm mostly thinking about the constraint to `` itself '' . I sometimes feel like generics can `` explode '' to other... | Weird use of generics |
C_sharp : I am trying to write documentation comments however I have a problem.When I reach the < T > Visual studio thinks I am trying to add another tag . what is the correct way to add comments like that ( and if I could make them click able in the generated help text that would be a extra bonus ) <code> /// < summar... | How to add items enclosed by < > to documentation comments |
C_sharp : I am working on a calculation module using C # , and I bumped on this : I know this is a wrong initialization that returns v = 0.0 instead of v = 0.04The c # rules says I must ensure at least one of the member is a double , like this : However , I have many many initializations of that kind that involves inte... | How to be warned about potential arithmetic errors due to type conversion ? |
C_sharp : I 'm using .NET 4.8 and declare a record with a Deconstructor : Then I use the following code which is compiled and it works fine : While this code does n't work an error is generated : '' Error CS0029 Can not implicitly convert type 'ConsoleApp4.Product ' to 'System.Tuple < string , int > ' '' ) : The declar... | What is the variable declaration `` var ( name , categoryId ) = object '' called in C # ? |
C_sharp : I am trying to make a regex match which is discarding the lookahead completely . This is the match and this is my regex101 test.But when an email starts with - or _ or . it should not match it completely , not just remove the initial symbols . Any ideas are welcome , I 've been searching for the past half an ... | Regex lookahead discard a match |
C_sharp : I 'm currently programming my own implementation of priority queue / sorted list and I would like to have it concurrent.In order to have it thread safe I 'm using lock ( someObject ) and I would like to verify some behavior of mutexes in C # .Inner representation of my sorted list is basically linked list wit... | Concurrent collection enumerator |
C_sharp : I 'm having a brain fart trying to make the following method more generic such that any List < T > can be passed in for the columnValues parameter . Here 's what I have : I could change it to a List < object > and convert the original list prior to passing it to the method but I 'm sure there is a better opti... | How can I make this extension method more generic ? |
C_sharp : For example , we know that `` int '' type in C # is nothing but a structure which is actually System.Int32 . If that so , then if `` using system ; '' is commented in a program , then int type should not be able to use . But still int type can be used . My question is , from where these types are coming from ... | In C # where does the key words come from if `` using system '' is commented ? |
C_sharp : I am building a POC application using the new MIP SDK on C # . One of the requirements is to use username/password stored on the server . All the example applications are using OAuth2 login with a popup window for user credentials input.I believe that properly implementing the IAuthDelegate may help , but in-... | Microsoft Information Protection SDK : using username/password to login |
C_sharp : I 'm new using .NET MVC Web Application . I 'm using the version 4 of Web Application.I 'm developing a page to manage the roles of the simple membership provider , and I want to it be dynamically . To clear what I mean , it would be something like this : Something really simple as that . To do so , I have a ... | Binding issue in a list at a complex model to an mvc application |
C_sharp : The argument to my function f ( ) must implement two different interfaces that are not related to each other by inheritance , IFoo and IBar . I know of two different ways of doing this . The first is to declare an empty interface that inherits from both : This , of course , requires that the classes declare t... | C # : Preferred pattern for functions requiring arguments that implement two interfaces |
C_sharp : We are trying to use an IEnumerable as a factory that generates different objects each time we iterate over it . Those should be GC'ed as soon as possible . Note however that we keep a reference to the enumerator so we can call it again . So our program basically looks like this : Looking at that code in the ... | When using `` yield '' why does compiler-generated type implement both IEnumerable and IEnumerator |
C_sharp : I 've used try and catch statements as an easy way to keep my code running without things crashing ( I would wrap everything in a big try ) . Recently , I 've wanted to start using try and catch statements more correctly . Here as an example I have questions about : In the above Ninja class , the entire conte... | Question About Where To Position Try And Catch statements |
C_sharp : Is there such a thing as a LINQ Query Provider for querying C # files ? I have a Winforms app that I use to assist me in generating code as well as to supplement Visual Studio 's editing capabilities for existing code . One thing I would like to be able to do is to query a given class to see if a method exist... | Is there a LINQ Query Provider for querying C # files ? |
C_sharp : I have two IQueryable collections having this kind of type Collection 1 , with the following Name values : Collection 2 , with the following Name values : What I would like to get is a third collection having Name values from Collections 1 and 2 matched , and if there is no match , than null ( empty ) , so as... | C # Linq full outer join on repetitive values |
C_sharp : I 'm trying to generate a certificate self-signed by a KeyPair stored in Azure KeyVault.My end result is a certificate with an invalid signature : Generating the certificate parameters : Fetching a reference to the Azure KeyVault stored key ( HSM like service ) : The key is successfully retrieved.I then try t... | Invalid signature when creating a certificate using BouncyCastle with an external Azure KeyVault ( HSM ) Key |
C_sharp : Suppose I want to be able to write queries likeWhere < Product > ( t= > t.Version > new Version ( 1,2,0,0 ) ) In Product table I store only Int64 NumVersion field , so Version property is mapped as component , and currently I query it like Where < Product > ( t= > t.Version.NumVersion > new Version ( 1,2,0,0 ... | NHibernate and operator overloading |
C_sharp : I 'm using Tridion 2011 's Event System to perform some additional actions when un-publishing components . I 'm using code found here to publish a related component.I 'm registering my event handler as follows : ... and my handler method is as follows : My problem is that the UnPublishEventArgs.Targets proper... | How to get the ( un- ) PublicationTarget for component UnPublish event in Tridion 2011 ? |
C_sharp : This may be a rather long and involved question . Let me start by saying that I 'm developing in C # and XAML . I want to create a control that stacks the following template : for a sequence of items , in two columns , like so : Notice that they are ordered first by height and then left to right.This is relat... | Create two-column , vertically-stacked columns control for Windows Phone 8 |
C_sharp : Can the compiler or processor reorder the following instructions so that another Thread sees a == 0 and b == 1 ? Assuming int a = 0 , b = 0 ; somewhere . <code> System.Threading.Interlocked.CompareExchange < int > ( ref a , 1 , 0 ) ; System.Threading.Interlocked.CompareExchange < int > ( ref b , 1 , 0 ) ; | .Net CompareExchange reordering |
C_sharp : Sanity-check here . Suppose I start a task but I do n't await it and I do n't store a reference to it . In other words , I just run : Clearly , without keeping a reference to the Task returned by PerformLongOperation ( ) , I have no way of knowing if and when it completes . But suppose that that 's not necess... | Will a task ever be interrupted by garbage collection if there are no references to it ? |
C_sharp : I 'm a bit confused about the following.Given this class : Why is an InvalidCastException thrown when I try to do the following ? <code> public class SomeClassToBeCasted { public static implicit operator string ( SomeClassToBeCasted rightSide ) { return rightSide.ToString ( ) ; } } IList < SomeClassToBeCasted... | C # .net casting question |
C_sharp : Recentelly I found an issue that at the beginning did n't appeared so dubious . Let me start by describing the big picture of my environment : I have a domain model respecting the Table Module architecture that consumes a data access layer written using Entity Framework 6.x . My application is a windows forms... | Caching domain model data |
C_sharp : In Visual Studio Professional 2010 whenever I type the following : It automatically changes to : Is there a way to make it not do this ? `` Object '' does not have the properties of the object I want to anonymously create . <code> new { new object { | Visual Studio Professional 2010 : Stop `` new { `` from autocompleting into `` new object { `` ( C # ) |
C_sharp : I have a C # program that has a list that does writes and reads in separate threads . The write is user initiated and can change the data at any random point in time . The read runs in a constant loop . It does n't matter if the read is missing data in any given loop , as long as the data it does receive is v... | Thread Safety : Lock vs Reference |
C_sharp : When I use asp-controller and asp-action in a < a > tag for another Action than the current , in a View called by a Controller Method with a [ Route ] attribute , the generated link have an empty href attribute.In the Controller : In the View : Generated html : As you can see , the first link is not generated... | Strange behaviour between tag-helpers and Route attribute in asp.net 5 MVC6 |
C_sharp : I am facing a problem in which I need to transform dates in a given input format into a target one . Is there any standard way to do this in C # ? As an example say we have yyyy.MM.dd as the source format and the target format is MM/dd/yyy ( current culture ) .The problem arises since I am using a parsing str... | Transform between datetime formats |
C_sharp : I have some classes in C # which I would like to use them in pipelines , I 've seen articles about it but I have n't been able to do it yet.Here 's how I am using it right now : And I want to be able to use it like this with pipelines : Here are my C # classes : And I am struggling to make these function avai... | Create PowerShell Cmdlets in C # - Pipeline chaining |
C_sharp : Can someone tell me the difference the following two LINQ statements please ? andChkUnique ! = null returns false for the top one when a match can not be found and true for the latter and I ca n't figure out why this is happening.I 'm new to LINQ so I could have missed something really basic but its driving m... | LINQ - Different syntax style , different result ? |
C_sharp : Recently , in a book i read this code . Can you define the means of this code and how this code works . <code> int i = 0 ; for ( ; i ! = 10 ; ) { Console.WriteLine ( i ) ; i++ ; } | How this looping works in c # |
C_sharp : Why does System.Convert has ToDateTime that accepts DateTime ? The method documentation states the value remain unchanged . <code> //// Summary : // Returns the specified System.DateTime object ; no actual conversion is performed.//// Parameters : // value : // A date and time value.//// Returns : // value is... | Why does System.Convert has ToDateTime that accepts DateTime ? |
C_sharp : There are a lot of questions on SO lamenting the fact that Code Analysis rule CA2000 is being applied possibly too rigorously by VS2010 , but I seem to have run into a case where it should be applied , but isn't.Consider the following code : Now if I run Code Analysis in Visual Studio 2010 on this , it will c... | Why does Bitmap cause rule CA2000 , but Image does not ? |
C_sharp : I have a method that takes a generic parameter T. Internally , to decide what other methods to call , I need to know ( without constraining it ) if that parameter is a List or just something.How do I do that ? I 've been using but that feels like a dirty approach . What 's cleaner ? <code> var isList = typeof... | Is my generic type a list , or just an item ? |
C_sharp : After reading this article & that article - I got confused.It says : If there are two methods at different levels of the hierarchy , the `` deeper '' one will be chosen first , even if it is n't a `` better function member '' for the call.Also - It turns out that if you override a base class method in a child... | Overloading across inheritance boundaries in c # ? |
C_sharp : We are using BasicHttpBinding in a service and also we have set the concurrency mode to multiple and instance context mode to single like belowWe have consumed this service in console through reference . We are having an issue that after some time we are seeing messages are pilled in IIS worker process.For ex... | Requests are piling up in WCF IIS server |
C_sharp : Are there any way to turn of the autoformatting of C # code that is inlined inside HTML when making a MVC application ? It seems that it use the C # Text Editor settings for the inline code as well , but I do n't want to use the same formatting inside the HTML file as the normal code files.For example , if I ... | Autoformating of inline code in MVC |
C_sharp : Ok , I must be doing something dumb , but should n't this work ? I have following three lists : Each list has the proper values and count . I can return any one of these lists : And I can return a any two of these lists : However , when I try to return all three : I get the exception : Unable to create a cons... | Concatenating three lists into one with LINQ throws an exception |
C_sharp : I 'm reading some examples and i keep seeing code with [ SOMETHING ] before methods and I 'd like to know what that 's called and how it 's used . Can you define you own [ SOMETHING ] or is there a defined list of these things ? Here 's some code examples I found that use this thing but do n't explain anythin... | .NET MVC 3 semantics |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.