여기드가면 해결됨
2022년 4월 30일 토요일
2022년 4월 29일 금요일
2022년 4월 24일 일요일
WPF Brush RGB in code
///WPF Brush RGB in code
var brush = new SolidColorBrush(Color.FromArgb(255, (byte)35, (byte)164, (byte)37));
button.Background = brush;
2022년 4월 22일 금요일
( c# create class object by name) c# 이름으로 클래스 객체 생성
using System.Reflection;
public object GenNewClass(string Type)
{
Assembly creator = Assembly.GetExecutingAssembly();
object obj = creator.CreateInstance(Type);
return obj;
}
foreach (PacketID state in Enum.GetValues(typeof(PacketID)))
{
ts.Add(GenNewClass(state.ToString()));
}
(Check all arguments of an Enum)Enum의 모든 인자 확인하기
public enum customEnum
{
aaaa,
bbbb,
ccccc,
ddddd,
}
foreach (customEnum item in Enum.GetValues(typeof(customEnum)))
{
Console.WriteLine(item.ToString());
}
2022년 4월 21일 목요일
c# A function that changes the value of a specific class field(특정클래스 필드값 변경하는 함수)
/// <summary>
/// 특정클래스의 field값을 변경하는 함수
/// ex) m_PLC_Data.Field_Write(m_PLC_Data, "posX",100);
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="exm"></param>
/// <param name="valueName"></param>
/// <param name="subject"></param>
public void Field_Write<T>(T exm, string valueName, object subject)
{
//Type tp = typeof(T);
Type tp = exm.GetType();
FieldInfo[] flds = tp.GetFields(BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public |
BindingFlags.NonPublic);
foreach (var t in flds)
{
if (valueName != t.Name)
continue;
object point = t.GetValue(exm);
if (point is int)
t.SetValue(exm, int.Parse(subject.ToString()));
if (point is float)
t.SetValue(exm, float.Parse(subject.ToString()));
if (point is string)
t.SetValue(exm, subject);
}
}
/// <summary>
/// 특정 클래스의 값을 읽어오는 함수
/// ex) Console.WriteLine(m_PLC_Data.Field_GetValue(m_PLC_Data, "posX"));
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="exm"></param>
/// <param name="valueName"></param>
/// <returns></returns>
public object Field_GetValue<T>(T exm, string valueName)
{
Type tp = exm.GetType();
FieldInfo[] flds = tp.GetFields(BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public |
BindingFlags.NonPublic);
object point = null;
foreach (var t in flds)
{
if (valueName != t.Name)
continue;
point = t.GetValue(exm);
break;
}
return point;
}
2022년 4월 20일 수요일
피드 구독하기:
글 (Atom)
git rejected error(feat. cherry-pick)
문제 아무 생각 없이 pull을 받지않고 로컬에서 작업! 커밋, 푸시 진행을 해버렷다. push에선 remote와 다르니 당연히 pull을 진행해라고 하지만 로컬에서 작업한 내용을 백업하지 않고 진행하기에는 부담스럽다(로컬작업 유실 가능성) 해결하려...
-
public class Test : MonoBehaviour { //매출 데이터를 읽어 들이고 Sales 객체 리스트를 반환한다. List<string> list = new List<string> { ...
-
1.람다식을 사용해 다음과 같은 코드를 작성합시다. var numbers = new List<int> { 12, 87, 94, 14, 53, 20, 40, 35, 76, 91, 31, 17, 48 }; 2.List<T>의 ...
-
legacy shader를 써야함 다른거는 변경해도 업데이트가 안됨