Questions tagged as 'c#'

1
answer

How to find out in what generation of garbage collector an object is allocated?

Considering my previous question or in> is it necessary to solve some kind of problem? In order for me to program correctly , do I need to know the generation in which an object is allocated?     
asked by 27.04.2017 / 20:25
1
answer

Conversion from Hex to Decimal using Complement of Two

I need to convert a string HEX to decimal , string uses the default Complement of Two and IEEE-754 to set the number of decimal places It is a tracking system, according to the manual a string C1B6DF66...
asked by 09.03.2018 / 01:08
6
answers

___ ___ verify erkimt repeated within the array number C # ______ qstntxt ___

I've created a pre-defined array with some numbers, and I want to know how many repeated numbers it has in the array. but it is only returning the size of the array and not qtd of repeated numbers. and also wanted to remove the repeated numbers.

%pre%     
______ azszpr271810 ___

Assign your array inside a HashSet, as it does not accept repeated values, and then you compare the sizes of both and know how many values were repeated:

%pre%     
______ azszpr271881 ___

As commented,

  

Manieiro :   Set "how many numbers repeated", this can be interpreted as   various forms.

The proposed answer presents a solution that depends exactly on which question is being asked.

  

Gabriel Coletta

%pre%

The result is 5 , a result of the original size difference of %code% subtracted from its %code% , which can also be written as %code%

%pre%

However, we come to a subjective point, 5 actually represents the number of repetitions of the values after their first occurrences, in other words, 5 is equal amount of duplicates or recurrences.

But when we look at the original set %code% , we can see that it has 8 elements of repeated values (which have more than one occurrence). What can be seen more easily by rearranging and removing unique occurrences %code% . And this difference greatly impacts the purpose of the query and what you intend to do with that result.

But the number of repeated numbers can also be aimed at knowing the number of numbers that have had more than one occurrence in the %code% case.

Below I leave a sample script only to demonstrate how I could respond to variations in interpretation according to the specified goal, using some lists to facilitate manipulation and a single %code% .

%pre%     
______ azszpr271818 ___

You are always comparing two equal numbers so the counter ultimately has the same length value. If you do not want to change the structure of your code, I suggest making these changes:

%pre%     
______ azszpr271812 ___

You're making two errors in your code:

The first is that the loop is checking its own number, ie when i and j are the same it compares the same number. The second error is break, finding a repeated number should not break the loop.

%pre%     
______ azszpr271824 ___

If you want to use you can also extract the two information:

Find the items and do not bring the replicates:

%pre%

Group the items and count the number of replicates:

%pre%

See working at dotnetfiddle.net

    
______ azszpr271835 ___

Actually you are comparing the number of the repeat loop and not the array int [] array1 , you have to store the value of the array in a variable, and within the if

  •     
    ___

    I've created a pre-defined array with some numbers, and I want to know how many repeated numbers it has in the array. but it is only returning the size of the array and not qtd of repeated numbers. and also wanted to remove the repeated numbers....
    asked by 25.01.2018 / 13:59
    1
    answer

    When and why to use the Obsolete attribute?

    At least on the projects I worked with, I see no point in using the Obsolete " in methods that are no longer used. What I do, and I see people doing is removing or commenting codes that are no longer used / obsolete. When and why shoul...
    asked by 11.02.2017 / 13:11
    1
    answer

    Develop application compatible with Windows 10 and Windows 8

    I'm working on an application that uses Windows Forms to develop its alpha version. Soon, we will start developing a more stable version of this system, and it was then that support platforms became the focus of our discussions. We have the d...
    asked by 14.02.2017 / 14:23
    2
    answers

    Enumeration class in Repository Pattern

    How can I read from my database a int attribute that in my system is an attribute of type Enumeration in Repository Pattern ? I made a class: public class Status : Enumeration { public static readonly Status Active =...
    asked by 27.12.2016 / 18:35
    3
    answers

    ASP.NET - How to use multiple post methods in the same controller?

    I have the following problem: On a given HTML page I have two buttons that call different POST methods on the same controller. @using (Html.BeginForm("UserInfo1", "UserInfo", FormMethod.Post)) { <input type="submit" value="Ir para Ac...
    asked by 06.06.2018 / 04:39
    2
    answers

    Text with line break

    I pass some product info to an external billing service (site). On the screen of this site, the past information is in the "description" field, inside a h3 element, which appears to have 25 spaces with flexible height. I go like this:...
    asked by 29.06.2018 / 14:43
    2
    answers

    Last cell line and column Epplus - C #

    I want to select a range from the first to the last cell filled in the row or column. In VBA the code stays as below using Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select How could I do it th...
    asked by 02.03.2017 / 17:41
    1
    answer

    Sql Server Stored Procedures [closed]

    I'm starting to develop an application, basically it's a business management control. The application will issue NFC-e, NFe, will control inventory, financial and etc., the database will be hosted on Azure. I started by modeling the database and...
    asked by 30.09.2016 / 15:34