Most voted "property" questions
111 questions
Sort by count of
-
3
votes1
answer53
viewsIs there any way to shorten the property declaration?
I know in C# it is possible to do this: public string propriedade { get; set; } Is there any short way to declare properties with the procedures Get and Set in Visual Basic? The only way I know is…
-
3
votes2
answers985
viewsCreate a property for a bool variable that handles string and int
I am creating a project in which I search the database information, in this case it is a DBF file, and the field is of the Logical type. However, I want to create a property that can receive a…
-
3
votes3
answers318
viewsDifference between properties syntax in C#
For what I researched, if I do: public int numero { get; set; } is the same thing as: private int numero; public int Numero { get{ return numero; } set{ numero = value; } } But in the first chunk of…
-
3
votes2
answers904
viewsHow to access properties of an object that is inside another object?
Deep down I want this output Console.WriteLine(cidade1.casas.dono); returns João using System; namespace arrayteste { public class cidade { public string nome { get; set; } public object casas {…
-
3
votes2
answers116
viewsIs that a Property, class attribute or what?
I have it in my code: public ICommand ChangePositionCommand => new Command((obj) => { _positionIndex++; if (_positionIndex >= Positions.Count) _positionIndex = 0; Position =…
-
3
votes1
answer535
viewsSave key with various values in Properties file
I have a file .properties where I carry the name of the tests that will be deleted from my application. This file needs to have the same name as the "variables" since they all mean the same thing…
-
3
votes1
answer176
viewsPass parameters with properties c#
I’m putting together a script of fighters, the category I want to be a private method and that it is according to the weight that the user type, but I’m not able to mix these two attributes in the…
-
2
votes1
answer1097
viewsevent on property or use addeventlistener
One thing I’ve always wondered if it’s standard to use addEventListener or the property of the tag <body onload="">. Some say it’s the addEventListener and others say it’s for property.…
-
2
votes2
answers439
viewsStore modified class properties
I need to have stored in the class itself a list with (name and value) of the changed properties. However, I don’t know if the form I am using is feasible. I have the class Employee below: public…
-
2
votes1
answer2062
viewsList all properties of a C#object?
I need to write all the primitive properties of a C# object regardless of how many "levels" I enter these objects. I have the following object in Javascript: var objeto = { propriedade:{ valor:42 },…
-
2
votes1
answer83
viewsIn python, how can I simulate a read-only property in classes?
I would like to know how I can simulate a read-only property on Python. For example, I have the following code: class IPInfo(object): def __init__(self, ip): self.ip = ip; ip = IPInfo(object) ip.ip…
-
2
votes2
answers213
viewsTreat return in class in C#
I have a class Table: public class Mesa { public int Cdmesa { get; set; } public int Flsituacao { get; set; } public string Status { get; set; } } I would like to return the Status with the…
-
2
votes1
answer117
viewsHow to change Java’s final property to C#?
Which property in C# corresponds to final Java, I need to change my variables final String mensagem = "Tokio Marine Seguradora S.A."; to something corresponding in C#. using System; namespace…
-
2
votes2
answers48
viewsCan a static method have the same name as a property?
Since a static method will not be an object method I can have a static method with the same name as a property defined within the constructor?
-
2
votes1
answer146
viewsWhat is the difference between Static::Property, Classname::property, self::property?
I know that the parent::propriedade, you select parent property, but I’m not able to differentiate these other three when I use within the scope of the class. Both work, but what’s the difference?…
-
2
votes3
answers120
viewsProperty defined in constructor only returns zero value
I created a Web API in C# that returns me a list of products in JSON. However, the property PrecoVenda is always returned with the value zero and I noticed that this occurs because in the class…
-
2
votes1
answer64
viewsDifference between property declaration in C#
I’m studying C#, very beginner, and I came across something, the course I’m doing has video lessons from 2015, and it passes me to create a class with attributes and properties like this:…
-
2
votes1
answer92
viewsList private properties
I have the following class: class Orcamento{ private $valor; private $itens; public function __construct($valor){ $this->valor = $valor; $this->itens = []; } public function __get($property){…
-
2
votes1
answer47
viewsHow to verify if object has specific property without the operator "in"?
Some browsers do not support inputMode, like Safari. So to then mitigate the situation, I would have another behavior if the inputMode existed or not. Searching I found the operator in: if…
-
1
votes2
answers1274
viewsCompare properties of an object with properties of a list
I have a method: public void MetodoAleatorio(List<RequisicaoFisicaDTO> lstRequisicaoFisicaDtos) { RequisicaoFisicaDTO requisicao = lstRequisicaoFisicaDtos.FirstOrDefault(); } Where I get a…
-
1
votes1
answer131
viewsKotlin - How to play the effect of "lateinit" on a "var" of an interface?
I have an interface called UserManager who owns a var of the kind User interface UserManager { var user:User /* ... */ } and a class called UserManagerImpl implementing UserManager class…
-
1
votes2
answers4588
viewsdefine environment variable in application.properties
I have a project in Spring boot where in application.properties I wanted to define the location of files that I will process. I don’t know the best way to do it. I wish I had the directory…
-
1
votes3
answers944
viewsJavascript - Function that returns value from a CSS property
Good evening (good morning or good afternoon) to all! I need a function that returns the value of a css property. Follow my code: CSS: .teste{ opacity: 0; display: none; } Javascript: function…
-
1
votes1
answer53
viewsData query in a datagrid (registration program)
The problem I’m having is that I don’t how to display in datagrid only the name of the users to be possible to query each registration in this database when selected, and then displaying all that…
-
1
votes1
answer46
viewsValue is not added to a variable within a function
I’m doing a simple quiz show with questions and answers, with punctuation. My problem is this: I made a function so that every time the answer is right, +1 will be added to the score variable.…
-
1
votes2
answers81
viewsHow to restrict a set of a property?
I have the following property in my class: public char Naipe { get; set; } This property can only receive one of the following values: (char)9824 (Espada) (char)9827 (Paus) (char)9829 (Copas)…
-
1
votes1
answer249
viewsWhat is the best location to provide a property file?
Has a Java project on Spring Boot which connects to the database. Consequently I have an application.yml properties file with the database connection settings. In this file of properties the…
-
1
votes1
answer142
viewsHow to put properties inside another property? VB.net
I would like to know how I can place properties within another property, as in the example below. Example: Open/Expanded Font Property I tried to do many times in various ways, but the closest I…
-
1
votes1
answer191
viewsRun method of one nested class as property in another in C#
I have the following class: public class Feliz : IFeliz { //public algumas propeiedades e tals... { get; set; } public bool EstaFeliz() { //Faz alguma coisa... } } And she’s a property in another…
-
1
votes2
answers123
viewsProperty with private set
There is a difference between declaring the set private or simply omitting it? public int UmaPropriedade {get; private set;} public int OutraPropriedade {get;} The two lines of code are equivalent?…
-
1
votes1
answer73
viewsHow to Perform Label Visibility Binding according to the size of a List
I have a list of objects of type "Basicvariable", a ObservableCollection of them, and I need the Graphical Interface to display a Label when the number of items in this Collection exceeds 1000, I…
-
1
votes1
answer161
viewsHow to access custom attributes of a property using VB.NET
I have a solution in VB.NET where I am implementing some custom Attributes. One of them is for properties, example: Namespace Attributes <AttributeUsage(AttributeTargets.Property)> Public…
-
1
votes0
answers69
viewsHow to create a Visual Studio C# property that opens the edit box
I’d like someone to help me with a situation. Whoever has an example please answer me. I would like to create a property in a User Control object, and that in this property opened the edit box, as…
-
1
votes1
answer246
viewsClasses with private Javascript properties
I’m starting my programming frontend, and started messing with classes in Javascript (following the standards set out in Ecmascript 6). But I’m having trouble using private property and methods. I…
-
1
votes1
answer203
viewsHow to destroy property of an object dynamically?
I’m implementing a chain of responsabilities, and, when the desired object is returned, it continues with the instances of the items after it: const ITEM_SELECIONADO = "EXEMPLO" export interface…
-
1
votes1
answer385
viewsHow to remove property inherited by the component?
When placing a side navigation icon, I noticed that a piece of it "leaked" out of the expected, which made it behave visually strange in the animation. I put a background-color: red for easy…
-
1
votes2
answers85
viewsHow to create a property in a Javascript method
Good evening everyone, I am a beginner in Javascript, and I have a question regarding the properties. How can I create a property in a method in Javascript? I mean the methods because I’m learning…
-
1
votes2
answers40
viewsBreaks in CSS measures
I’m really confused how the measurement percentages of CSS (in particular %) and property height html { border: solid 5px #000000; height: 600px; margin: 10px; } body { border: solid 5px #470eaf;…
-
0
votes1
answer1899
viewsAccess attribute of a JS object using the key of another attribute
I’m trying to get the value inside a given object using the key of another object: Ex: I have the objects: var obj1 = { id:'gh73f'} var obj2 = { gh73f : 123, h39sg : 764, c9wer : 921 } I tried to:…
-
0
votes2
answers1460
viewsStarting an Array of a private attribute in another class
I’m doing some exercises and I came across a problem, follow part of my code: class Empresa{ public String nome; public String cnpj; private Funcionario[] empregados; public String rua; public…
-
0
votes1
answer591
viewsAccessing a file using Properties
I am working with a method that takes as argument an object from the Properties class: public static void main(String[] args) { //Properties props = new Properties(); Properties props = new…
-
0
votes1
answer457
viewsPass variables in Jquery . css()
I’m having trouble with the following code: //Desktop = D var posicaoMenuD = $('#desktop-menu').position().top(); $(document).scroll(function(){//Alscutador de scroll da página var posicaoScrollD =…
-
0
votes1
answer52
viewsFlex display and width of child elements not working
I am developing a form, however, an error occurred on the page, the elements stay with a margin until the end of the width of the parent div, even if setting a margin 0 and a width less than 50%…
-
0
votes2
answers448
viewsThe "Color.Name" property or indexer cannot be assigned, as it is read-only
Follow code where I define SegundaTela: public partial class Form1 : Form { SegundaTela telaSecundaria; } Code: telaSecundaria = new SegundaTela(); telaSecundaria.label_segunda_tela.BackColor.Name =…
-
0
votes1
answer171
viewsHow to put class information in an array?
To save lines of code, I do the following: PictureBox[] pic = { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8 }; And I have a class called…
-
0
votes2
answers134
viewsSet the name of a property dynamically in VB.NET
I have a class with a public property in it. As follows in the example: Public Property exemplo As List(Of Uso) Get Return x_exemplo End Get Set x_exemplo = Value End Set End Property Private…
-
0
votes1
answer282
viewsHow to pass an array to a property?
I am trying to pass an array of Strings and two Talignment arrays to three properties (Published). But I’m having the following mistake (which is the same for the three properties): [dcc32 Error]…
-
0
votes1
answer1166
viewsCircumvent "object property does not exist" error
I have the following problem, always time to deal with the result of the request http in the subscribe points out errors saying the property x does not exist in result return…
-
0
votes0
answers19
viewsQuotes on property name (Javascript)
There is difference between the properties "Gift" and Gift?…
-
0
votes1
answer24
viewsComputed property Polymer
Greetings. My problem is this. I have a product detail page. It is accessed after clicking on a specific product on another listing page, the content is displayed through the product ID. So far so…